码迷,mamicode.com
首页 > Web开发 > 详细

dockerfile+ubuntu+nginx搭建web环境

时间:2018-06-17 19:01:56      阅读:1040      评论:0      收藏:0      [点我收藏+]

标签:use   安装nginx   五行   curl   pack   locate   apt-get   etc   too   

准备目录

[root@izchz ~]# mkdir /usr/local/dockerfile1

该目录下准备Dockerfile文件

1 FROM ubuntu
2 MAINTAINER xbf
3 RUN sed -i s/archive.ubuntu.com/mirrors.ustc.edu.cn/g /etc/apt/sources.list
4 RUN apt-get update
5 RUN apt-get install -y nginx
6 COPY index.html /var/www/html
7 ENTRYPOINT ["/usr/sbin/nginx","g","daemon off;"]
8 EXPOSE 8080

解释下各行的意思

第一行:说明依赖ubuntu

第二行:作者是xbf

第三行:加速

第四行:更新一下环境

第五行:安装nginx,-y就是表示不要总是询问

第六行:拷贝服务器当前目录里的index.html到nginx里

第七行:让nginx前台运行

第八行:端口

更多Dockerfile语法

技术分享图片

同目录下准备index.html文件

内容就一句话

What day is it today?

构建镜像

[root@iz2zeh5mjwg5u2vl2fawchz dockerfile1]# docker build -t xbf/hello-nginx .
Sending build context to Docker daemon 3.072 kB
Step 1/8 : FROM ubuntu
Trying to pull repository docker.io/library/ubuntu ...
latest: Pulling from docker.io/library/ubuntu
6b98dfc16071: Pull complete
4001a1209541: Pull complete
6319fc68c576: Pull complete
b24603670dc3: Pull complete
97f170c87c6f: Pull complete
Digest: sha256:5f4bdc3467537cbbe563e80db2c3ec95d548a9145d64453b06939c4592d67b6d
Status: Downloaded newer image for docker.io/ubuntu:latest
 ---> 113a43faa138
Step 2/8 : MAINTAINER xbf
 ---> Running in 118668b4905a
 ---> 78bb87f20383
Removing intermediate container 118668b4905a
Step 3/8 : RUN sed -i s/archive.ubuntu.com/mirrors.ustc.edu.cn/g /etc/apt/sources.list
 ---> Running in 9bbb6c182746

 ---> 24ef42b63544
Removing intermediate container 9bbb6c182746
Step 4/8 : RUN apt-get update
 ---> Running in 2c8511a15eb7

Get:1 http://mirrors.ustc.edu.cn/ubuntu bionic InRelease [242 kB]
Get:2 http://mirrors.ustc.edu.cn/ubuntu bionic-updates InRelease [83.2 kB]
Get:3 http://mirrors.ustc.edu.cn/ubuntu bionic-backports InRelease [74.6 kB]
Get:4 http://mirrors.ustc.edu.cn/ubuntu bionic/universe Sources [11.5 MB]
Get:5 http://mirrors.ustc.edu.cn/ubuntu bionic/multiverse amd64 Packages [186 kB]
Get:6 http://mirrors.ustc.edu.cn/ubuntu bionic/restricted amd64 Packages [13.5 kB]
Get:7 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 Packages [1344 kB]
Get:8 http://mirrors.ustc.edu.cn/ubuntu bionic/universe amd64 Packages [11.3 MB]
Get:9 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Get:10 http://mirrors.ustc.edu.cn/ubuntu bionic-updates/universe Sources [32.4 kB]
Get:11 http://mirrors.ustc.edu.cn/ubuntu bionic-updates/universe amd64 Packages [106 kB]
Get:12 http://mirrors.ustc.edu.cn/ubuntu bionic-updates/multiverse amd64 Packages [1663 B]
Get:13 http://mirrors.ustc.edu.cn/ubuntu bionic-updates/main amd64 Packages [178 kB]
Get:14 http://mirrors.ustc.edu.cn/ubuntu bionic-backports/universe amd64 Packages [2793 B]
Get:15 http://security.ubuntu.com/ubuntu bionic-security/universe Sources [5646 B]
Get:16 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [38.5 kB]
Get:17 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [123 kB]
Get:18 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [1075 B]
Fetched 25.4 MB in 8s (3044 kB/s)
Reading package lists...
 ---> b26a1de6e650
Removing intermediate container 2c8511a15eb7
Step 5/8 : RUN apt-get install -y nginx
 ---> Running in e88fccbe2bf6

Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  fontconfig-config fonts-dejavu-core geoip-database libbsd0 libexpat1
  libfontconfig1 libfreetype6 libgd3 libgeoip1 libicu60 libjbig0
  libjpeg-turbo8 libjpeg8 libnginx-mod-http-geoip
  libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter
  libnginx-mod-mail libnginx-mod-stream libpng16-16 libssl1.1 libtiff5
  libwebp6 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxml2 libxpm4
  libxslt1.1 multiarch-support nginx-common nginx-core ucf
Suggested packages:
  libgd-tools geoip-bin fcgiwrap nginx-doc ssl-cert
The following NEW packages will be installed:
  fontconfig-config fonts-dejavu-core geoip-database libbsd0 libexpat1
  libfontconfig1 libfreetype6 libgd3 libgeoip1 libicu60 libjbig0
  libjpeg-turbo8 libjpeg8 libnginx-mod-http-geoip
  libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter
  libnginx-mod-mail libnginx-mod-stream libpng16-16 libssl1.1 libtiff5
  libwebp6 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxml2 libxpm4
  libxslt1.1 multiarch-support nginx nginx-common nginx-core ucf
0 upgraded, 35 newly installed, 0 to remove and 7 not upgraded.
Need to get 16.1 MB of archives.
After this operation, 58.8 MB of additional disk space will be used.
Get:1 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 multiarch-support amd64 2.27-3ubuntu1 [6916 B]
Get:2 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libxau6 amd64 1:1.0.8-1 [8376 B]
Get:3 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libjpeg-turbo8 amd64 1.5.2-0ubuntu5 [110 kB]
Get:4 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libbsd0 amd64 0.8.7-1 [41.5 kB]
Get:5 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libexpat1 amd64 2.2.5-3 [80.2 kB]
Get:6 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libicu60 amd64 60.2-3ubuntu3 [8054 kB]
Get:7 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libssl1.1 amd64 1.1.0g-2ubuntu4 [1128 kB]
Get:8 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libxml2 amd64 2.9.4+dfsg1-6.1ubuntu1 [662 kB]
Get:9 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 ucf all 3.0038 [50.5 kB]
Get:10 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 geoip-database all 20180315-1 [2090 kB]
Get:11 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libgeoip1 amd64 1.6.12-1 [71.8 kB]
Get:12 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libpng16-16 amd64 1.6.34-1 [176 kB]
Get:13 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libxdmcp6 amd64 1:1.1.2-3 [10.7 kB]
Get:14 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libxcb1 amd64 1.13-1 [45.6 kB]
Get:15 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libx11-data all 2:1.6.4-3 [114 kB]
Get:16 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libx11-6 amd64 2:1.6.4-3 [572 kB]
Get:17 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 fonts-dejavu-core all 2.37-1 [1041 kB]
Get:18 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 fontconfig-config all 2.12.6-0ubuntu2 [55.8 kB]
Get:19 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libfreetype6 amd64 2.8.1-2ubuntu2 [335 kB]
Get:20 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libfontconfig1 amd64 2.12.6-0ubuntu2 [137 kB]
Get:21 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libjpeg8 amd64 8c-2ubuntu8 [2194 B]
Get:22 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libjbig0 amd64 2.1-3.1build1 [26.7 kB]
Get:23 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libtiff5 amd64 4.0.9-5 [152 kB]
Get:24 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libwebp6 amd64 0.6.1-2 [185 kB]
Get:25 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libxpm4 amd64 1:3.5.12-1 [34.0 kB]
Get:26 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libgd3 amd64 2.2.5-4 [118 kB]
Get:27 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 nginx-common all 1.14.0-0ubuntu1 [37.0 kB]
Get:28 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libnginx-mod-http-geoip amd64 1.14.0-0ubuntu1 [10.8 kB]
Get:29 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libnginx-mod-http-image-filter amd64 1.14.0-0ubuntu1 [14.2 kB]
Get:30 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libxslt1.1 amd64 1.1.29-5 [150 kB]
Get:31 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libnginx-mod-http-xslt-filter amd64 1.14.0-0ubuntu1 [12.6 kB]
Get:32 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libnginx-mod-mail amd64 1.14.0-0ubuntu1 [41.4 kB]
Get:33 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 libnginx-mod-stream amd64 1.14.0-0ubuntu1 [63.3 kB]
Get:34 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 nginx-core amd64 1.14.0-0ubuntu1 [412 kB]
Get:35 http://mirrors.ustc.edu.cn/ubuntu bionic/main amd64 nginx all 1.14.0-0ubuntu1 [3596 B]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 16.1 MB in 2s (7706 kB/s)
Selecting previously unselected package multiarch-support.
(Reading database ... 4035 files and directories currently installed.)
Preparing to unpack .../multiarch-support_2.27-3ubuntu1_amd64.deb ...
Unpacking multiarch-support (2.27-3ubuntu1) ...
Setting up multiarch-support (2.27-3ubuntu1) ...
Selecting previously unselected package libxau6:amd64.
(Reading database ... 4038 files and directories currently installed.)
Preparing to unpack .../00-libxau6_1%3a1.0.8-1_amd64.deb ...
Unpacking libxau6:amd64 (1:1.0.8-1) ...
Selecting previously unselected package libjpeg-turbo8:amd64.
Preparing to unpack .../01-libjpeg-turbo8_1.5.2-0ubuntu5_amd64.deb ...
Unpacking libjpeg-turbo8:amd64 (1.5.2-0ubuntu5) ...
Selecting previously unselected package libbsd0:amd64.
Preparing to unpack .../02-libbsd0_0.8.7-1_amd64.deb ...
Unpacking libbsd0:amd64 (0.8.7-1) ...
Selecting previously unselected package libexpat1:amd64.
Preparing to unpack .../03-libexpat1_2.2.5-3_amd64.deb ...
Unpacking libexpat1:amd64 (2.2.5-3) ...
Selecting previously unselected package libicu60:amd64.
Preparing to unpack .../04-libicu60_60.2-3ubuntu3_amd64.deb ...
Unpacking libicu60:amd64 (60.2-3ubuntu3) ...
Selecting previously unselected package libssl1.1:amd64.
Preparing to unpack .../05-libssl1.1_1.1.0g-2ubuntu4_amd64.deb ...
Unpacking libssl1.1:amd64 (1.1.0g-2ubuntu4) ...
Selecting previously unselected package libxml2:amd64.
Preparing to unpack .../06-libxml2_2.9.4+dfsg1-6.1ubuntu1_amd64.deb ...
Unpacking libxml2:amd64 (2.9.4+dfsg1-6.1ubuntu1) ...
Selecting previously unselected package ucf.
Preparing to unpack .../07-ucf_3.0038_all.deb ...
Moving old data out of the way
Unpacking ucf (3.0038) ...
Selecting previously unselected package geoip-database.
Preparing to unpack .../08-geoip-database_20180315-1_all.deb ...
Unpacking geoip-database (20180315-1) ...
Selecting previously unselected package libgeoip1:amd64.
Preparing to unpack .../09-libgeoip1_1.6.12-1_amd64.deb ...
Unpacking libgeoip1:amd64 (1.6.12-1) ...
Selecting previously unselected package libpng16-16:amd64.
Preparing to unpack .../10-libpng16-16_1.6.34-1_amd64.deb ...
Unpacking libpng16-16:amd64 (1.6.34-1) ...
Selecting previously unselected package libxdmcp6:amd64.
Preparing to unpack .../11-libxdmcp6_1%3a1.1.2-3_amd64.deb ...
Unpacking libxdmcp6:amd64 (1:1.1.2-3) ...
Selecting previously unselected package libxcb1:amd64.
Preparing to unpack .../12-libxcb1_1.13-1_amd64.deb ...
Unpacking libxcb1:amd64 (1.13-1) ...
Selecting previously unselected package libx11-data.
Preparing to unpack .../13-libx11-data_2%3a1.6.4-3_all.deb ...
Unpacking libx11-data (2:1.6.4-3) ...
Selecting previously unselected package libx11-6:amd64.
Preparing to unpack .../14-libx11-6_2%3a1.6.4-3_amd64.deb ...
Unpacking libx11-6:amd64 (2:1.6.4-3) ...
Selecting previously unselected package fonts-dejavu-core.
Preparing to unpack .../15-fonts-dejavu-core_2.37-1_all.deb ...
Unpacking fonts-dejavu-core (2.37-1) ...
Selecting previously unselected package fontconfig-config.
Preparing to unpack .../16-fontconfig-config_2.12.6-0ubuntu2_all.deb ...
Unpacking fontconfig-config (2.12.6-0ubuntu2) ...
Selecting previously unselected package libfreetype6:amd64.
Preparing to unpack .../17-libfreetype6_2.8.1-2ubuntu2_amd64.deb ...
Unpacking libfreetype6:amd64 (2.8.1-2ubuntu2) ...
Selecting previously unselected package libfontconfig1:amd64.
Preparing to unpack .../18-libfontconfig1_2.12.6-0ubuntu2_amd64.deb ...
Unpacking libfontconfig1:amd64 (2.12.6-0ubuntu2) ...
Selecting previously unselected package libjpeg8:amd64.
Preparing to unpack .../19-libjpeg8_8c-2ubuntu8_amd64.deb ...
Unpacking libjpeg8:amd64 (8c-2ubuntu8) ...
Selecting previously unselected package libjbig0:amd64.
Preparing to unpack .../20-libjbig0_2.1-3.1build1_amd64.deb ...
Unpacking libjbig0:amd64 (2.1-3.1build1) ...
Selecting previously unselected package libtiff5:amd64.
Preparing to unpack .../21-libtiff5_4.0.9-5_amd64.deb ...
Unpacking libtiff5:amd64 (4.0.9-5) ...
Selecting previously unselected package libwebp6:amd64.
Preparing to unpack .../22-libwebp6_0.6.1-2_amd64.deb ...
Unpacking libwebp6:amd64 (0.6.1-2) ...
Selecting previously unselected package libxpm4:amd64.
Preparing to unpack .../23-libxpm4_1%3a3.5.12-1_amd64.deb ...
Unpacking libxpm4:amd64 (1:3.5.12-1) ...
Selecting previously unselected package libgd3:amd64.
Preparing to unpack .../24-libgd3_2.2.5-4_amd64.deb ...
Unpacking libgd3:amd64 (2.2.5-4) ...
Selecting previously unselected package nginx-common.
Preparing to unpack .../25-nginx-common_1.14.0-0ubuntu1_all.deb ...
Unpacking nginx-common (1.14.0-0ubuntu1) ...
Selecting previously unselected package libnginx-mod-http-geoip.
Preparing to unpack .../26-libnginx-mod-http-geoip_1.14.0-0ubuntu1_amd64.deb ...
Unpacking libnginx-mod-http-geoip (1.14.0-0ubuntu1) ...
Selecting previously unselected package libnginx-mod-http-image-filter.
Preparing to unpack .../27-libnginx-mod-http-image-filter_1.14.0-0ubuntu1_amd64.deb ...
Unpacking libnginx-mod-http-image-filter (1.14.0-0ubuntu1) ...
Selecting previously unselected package libxslt1.1:amd64.
Preparing to unpack .../28-libxslt1.1_1.1.29-5_amd64.deb ...
Unpacking libxslt1.1:amd64 (1.1.29-5) ...
Selecting previously unselected package libnginx-mod-http-xslt-filter.
Preparing to unpack .../29-libnginx-mod-http-xslt-filter_1.14.0-0ubuntu1_amd64.deb ...
Unpacking libnginx-mod-http-xslt-filter (1.14.0-0ubuntu1) ...
Selecting previously unselected package libnginx-mod-mail.
Preparing to unpack .../30-libnginx-mod-mail_1.14.0-0ubuntu1_amd64.deb ...
Unpacking libnginx-mod-mail (1.14.0-0ubuntu1) ...
Selecting previously unselected package libnginx-mod-stream.
Preparing to unpack .../31-libnginx-mod-stream_1.14.0-0ubuntu1_amd64.deb ...
Unpacking libnginx-mod-stream (1.14.0-0ubuntu1) ...
Selecting previously unselected package nginx-core.
Preparing to unpack .../32-nginx-core_1.14.0-0ubuntu1_amd64.deb ...
Unpacking nginx-core (1.14.0-0ubuntu1) ...
Selecting previously unselected package nginx.
Preparing to unpack .../33-nginx_1.14.0-0ubuntu1_all.deb ...
Unpacking nginx (1.14.0-0ubuntu1) ...
Setting up libexpat1:amd64 (2.2.5-3) ...
Setting up libicu60:amd64 (60.2-3ubuntu3) ...
Setting up geoip-database (20180315-1) ...
Setting up libpng16-16:amd64 (1.6.34-1) ...
Setting up libjbig0:amd64 (2.1-3.1build1) ...
Setting up fonts-dejavu-core (2.37-1) ...
Setting up nginx-common (1.14.0-0ubuntu1) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Cant locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up libjpeg-turbo8:amd64 (1.5.2-0ubuntu5) ...
Setting up libgeoip1:amd64 (1.6.12-1) ...
Setting up libbsd0:amd64 (0.8.7-1) ...
Setting up ucf (3.0038) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Cant locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up libxml2:amd64 (2.9.4+dfsg1-6.1ubuntu1) ...
Setting up libfreetype6:amd64 (2.8.1-2ubuntu2) ...
Setting up libxslt1.1:amd64 (1.1.29-5) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up libssl1.1:amd64 (1.1.0g-2ubuntu4) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Cant locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up libnginx-mod-mail (1.14.0-0ubuntu1) ...
Setting up libnginx-mod-http-xslt-filter (1.14.0-0ubuntu1) ...
Setting up libxdmcp6:amd64 (1:1.1.2-3) ...
Setting up libnginx-mod-http-geoip (1.14.0-0ubuntu1) ...
Setting up libx11-data (2:1.6.4-3) ...
Setting up libxau6:amd64 (1:1.0.8-1) ...
Setting up libwebp6:amd64 (0.6.1-2) ...
Setting up libjpeg8:amd64 (8c-2ubuntu8) ...
Setting up fontconfig-config (2.12.6-0ubuntu2) ...
Setting up libnginx-mod-stream (1.14.0-0ubuntu1) ...
Setting up libtiff5:amd64 (4.0.9-5) ...
Setting up libxcb1:amd64 (1.13-1) ...
Setting up libfontconfig1:amd64 (2.12.6-0ubuntu2) ...
Setting up libx11-6:amd64 (2:1.6.4-3) ...
Setting up libxpm4:amd64 (1:3.5.12-1) ...
Setting up libgd3:amd64 (2.2.5-4) ...
Setting up libnginx-mod-http-image-filter (1.14.0-0ubuntu1) ...
Setting up nginx-core (1.14.0-0ubuntu1) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Setting up nginx (1.14.0-0ubuntu1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
 ---> 0d85124c0053
Removing intermediate container e88fccbe2bf6
Step 6/8 : COPY index.html /var/www/html
 ---> 47982e76c320
Removing intermediate container 372e2185a512
Step 7/8 : ENTRYPOINT /usr/sbin/nginx g daemon off;
 ---> Running in a973e7d68e60
 ---> a7802784dfb1
Removing intermediate container a973e7d68e60
Step 8/8 : EXPOSE 8080
 ---> Running in b8455236eca0
 ---> 2230ac934a5f
Removing intermediate container b8455236eca0
Successfully built 2230ac934a5f

看到successfully就说明成功了

查看构建的镜像

[root@iz2zeh5mjwg5u2vl2fawchz dockerfile1]# docker images
REPOSITORY                                           TAG                 IMAGE ID            CREATED             SIZE
xbf/hello-nginx                                      latest              2230ac934a5f        16 minutes ago      179 MB
hello_docker                                         latest              65d690c9d782        57 minutes ago      4.15 MB
docker.io/ubuntu                                     latest              113a43faa138        11 days ago         81.2 MB
docker.io/centos                                     latest              49f7960eb7e4        12 days ago         200 MB
docker.io/stephenreed/jenkins-java8-maven-git        latest              3670d4afa617        2 months ago        682 MB
docker.io/alpine                                     latest              3fd9065eaf02        5 months ago        4.15 MB
docker.io/stephenreed/java8-jenkins-maven-git-nano   latest              508ef553bf1a        3 years ago         1.5 GB

运行构建好的镜像

[root@iz2zeh5mjwg5u2vl2fawchz dockerfile1]# docker run -d -p 8080:8080 xbf/hello-nginx
84d5d2b00de5544aa3810f9d1111f92dc4146c5bbafb6a02371a52b1a2b4575b

 测试

[root@izwchz dockerfile1]# curl http://localhost:8080

输出What day is it today?

dockerfile+ubuntu+nginx搭建web环境

标签:use   安装nginx   五行   curl   pack   locate   apt-get   etc   too   

原文地址:https://www.cnblogs.com/shamo89/p/9193260.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!