欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

使用Dockerfile编译自己的docker镜像

程序员文章站 2023-12-30 13:43:28
...

演示一个镜像包含apache

1、新建Dockerfile

vi Dockerfile

 2、填入如下内容

# Version 0.0.1
From centos
MAINTAINER "wiselyman"
RUN yum -y update
RUN yum -y install httpd
EXPOSE 80
CMD /usr/sbin/apachectl -D FOREGROUND

 

3、编译

docker build -t localhost:5000/centos_httpd - < Dockerfile

 

4、查看

docker images

 结果

REPOSITORY                                TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
localhost:5000/centos_httpd               latest              53ee0b916001        18 minutes ago      340 MB

 

 

上一篇:

下一篇: