赞
踩
[root@localhost ~]# vim Dockerfile
1、基于基础镜像centos:7
FROM centos:7
2、维护者信息
MAINTAINER haha@example.com
3、添加Centos-7仓库
ADD Centos-7.repo /etc/yum.repos.d/
4、添加epel-7仓库
ADD epel-7.repo /etc/yum.repos.d/
5、安装nginx软件包
RUN yum -y install nginx
6、暴露指定端口80
EXPOSE 80
CMD ["/usr/sbin/nginx","-g","daemon off;"]
7、构建镜像,镜像名称为nginx:v1 [root@localhost ~]# docker build -t nginx:v1 . Sending build context to Docker daemon 25.6kB Step 1/7 : FROM centos:7 7: Pulling from library/centos 2d473b07cdd5: Pull complete Digest: sha256:9d4bcbbb213dfd745b58be38b13b996ebb5ac315fe75711bd618426a630e0987 Status: Downloaded newer image for centos:7 ---> eeb6ee3f44bd Step 2/7 : MAINTAINER yijq200708@example.com ---> Running in 1451d5aa895f Removing intermediate container 1451d5aa895f ---> 0122bfda9eb9 Step 3/7 : ADD Centos-7.repo /etc/yum.repos.d/ ---> 0589b92f5fb4 Step 4/7 : ADD epel-7.repo /etc/yum.repos.d/ ---> f28e41208a24 Step 5/7 : RUN yum -y install nginx ---> Running in 98171c0bbe0a Loaded plugins: fastestmirror, ovl Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Determining fastest mirrors * base: mirrors.bupt.edu.cn * extras: mirrors.bupt.edu.cn * updates: mirrors.bfsu.edu.cn Resolving Dependencies --> Running transaction check ---> Package nginx.x86_64 1:1.20.1-9.el7 will be installed --> Processing Dependency: nginx-filesystem = 1:1.20.1-9.el7 for package: 1:nginx-1.20.1-9.el7.x86_64 --> Processing Dependency: libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64 --> Processing Dependency: libssl.so.1.1(OPENSSL_1_1_0)(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64 --> Processing Dependency: libssl.so.1.1(OPENSSL_1_1_1)(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64 --> Processing Dependency: nginx-filesystem for package: 1:nginx-1.20.1-9.el7.x86_64 --> Processing Dependency: openssl for package: 1:nginx-1.20.1-9.el7.x86_64 --> Processing Dependency: redhat-indexhtml for package: 1:nginx-1.20.1-9.el7.x86_64 --> Processing Dependency: system-logos for package: 1:nginx-1.20.1-9.el7.x86_64 --> Processing Dependency: libcrypto.so.1.1()(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64 --> Processing Dependency: libprofiler.so.0()(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64 --> Processing Dependency: libssl.so.1.1()(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64 --> Running transaction check ---> Package centos-indexhtml.noarch 0:7-9.el7.centos will be installed ---> Package centos-logos.noarch 0:70.0.6-3.el7.centos will be installed ---> Package gperftools-libs.x86_64 0:2.6.1-1.el7 will be installed ---> Package nginx-filesystem.noarch 1:1.20.1-9.el7 will be installed ---> Package openssl.x86_64 1:1.0.2k-25.el7_9 will be installed --> Processing Dependency: openssl-libs(x86-64) = 1:1.0.2k-25.el7_9 for package: 1:openssl-1.0.2k-25.el7_9.x86_64 --> Processing Dependency: make for package: 1:openssl-1.0.2k-25.el7_9.x86_64 ---> Package openssl11-libs.x86_64 1:1.1.1k-4.el7 will be installed --> Runni
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。