基于上次制作的centos-systemctl:1.0镜像,在其上安装nginx rpm,并构建nginx镜像。
1.制作nginx Dockerfile,并保存
命令:
vim Dockerfile
FROM centos-systemctl:1.0
MAINTAINER ztj
COPY nginx.repo /etc/yum.repos.d/
COPY epel.repo /etc/yum.repos.d/
COPY epel-testing.repo /etc/yum.repos.d/
RUN yum install nginx net-tools -y
EXPOSE 80
2.基于Dockerfile创建镜像
命令:
docker build -f Dockerfile -t centos-nginx:1.0 .
[root@centos79 ~]# docker build -f Dockerfile -t centos-nginx:1.0 .
[+] Building 0.2s (10/10) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 237B 0.0s
&#