# 命令最后的点表示Dockerfile所在目录
[root@h1 my-first-Dockerfile]# docker build -t="hylexus/nginx-1" .
Sending build context to Docker daemon 4.096 kB
Sending build context to Docker daemon
Step 0 : FROM centos:6.8
---> 80e46367f846
Step 1 : MAINTAINER hylexus "hylexus@163.com"
---> Using cache
---> c518397fc23e
Step 2 : COPY ./nginx.repo /etc/yum.repos.d/nginx.repo
---> 5c6e01981678
Removing intermediate container c6e430804af3
Step 3 : RUN yum makecache
---> Running in d17bef44ff52
Loaded plugins: fastestmirror, ovl
Metadata Cache Created
---> 25e01b8498fc
Removing intermediate container d17bef44ff52
Step 4 : RUN yum install -y nginx
---> Running in 3054e6a7d381
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Determining fastest mirrors
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 0:1.10.1-1.el6.ngx will be installed
# 此处省略N行.....
--> Running transaction check
---> Package dbus-glib.x86_64 0:0.86-6.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
nginx x86_64 1.10.1-1.el6.ngx nginx 821 k
Installing for dependencies:
# 此处省略N行...
util-linux-ng x86_64 2.17.2-12.24.el6 base 1.6 M
Transaction Summary
================================================================================
Install 15 Package(s)
Total download size: 21 M
Installed size: 41 M
Downloading Packages:
--------------------------------------------------------------------------------
Total 356 kB/s | 21 MB 01:01
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
Package: centos-release-6-8.el6.centos.12.3.x86_64 (@CentOS/6.8)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : hwdata-0.233-16.1.el6.noarch 1/15
# 此处省略N行……
Installing : nginx-1.10.1-1.el6.ngx.x86_64 15/15
----------------------------------------------------------------------
Thanks for using nginx!
Please find the official documentation for nginx here:
* http://nginx.org/en/docs/
Commercial subscriptions for nginx are available on:
* http://nginx.com/products/
----------------------------------------------------------------------
Verifying : iptables-1.4.7-16.el6.x86_64 1/15
# 此处省略N行
Verifying : hwdata-0.233-16.1.el6.noarch 15/15
Installed:
nginx.x86_64 0:1.10.1-1.el6.ngx
Dependency Installed:
#此处省略N行……
util-linux-ng.x86_64 0:2.17.2-12.24.el6
Complete!
---> 8741ff7c796b
Removing intermediate container 3054e6a7d381
Step 5 : RUN echo "home page of container niginx server" > /usr/share/nginx/html/index.html
---> Running in 81627cb51b65
---> 0d610e7a0000
Removing intermediate container 81627cb51b65
Step 6 : EXPOSE 80
---> Running in 778468b1dcea
---> 9f18a04cafcb
Removing intermediate container 778468b1dcea
Successfully built 9f18a04cafcb
[root@h1 my-first-Dockerfile]#