Introduction
This is an article for building a docker image. In this article, the docker image is a CentOS operating system docker image with Nginx Webserver installed in it. The installation process of Nginx is actually part of the docker image building process. Actually, this article has a connection with several articles written in the previous one. Those articles are the article in this link where it has the title of ‘How to Build CentOS Docker Image using Dockerfile’. Another article is also exist in this link with the title of ‘How to Build CentOS Docker Image and Update it using Dockerfile’. In order to focus on a specific step or process, there are parts of the article discussing on a specific part The first part is for creating the Dockerfile file. Continue on to the next step, the second part is for building docker image. The last part is for running the docker image.
Creating Dockerfile file for Building Docker Image
This is the first part. It is an important part for the continuity onto the next part. It is creating Dockerfile file. The following is the content of the Dockerfile :
#Getting base image from CentOS 7 FROM centos MAINTAINER myself <[email protected]> LABEL Remarks="This is a Dockerfile for CentOS System" #Update Software Repository RUN yum -y install epel-release RUN yum -y update RUN yum -y install nginx ENTRYPOINT ["/usr/sbin/nginx", "-g", "daemon off;"]
Building Docker Image
Building Docker Image.
user@hostname:~/docker/centos/nginx$ docker build -t centos:7 . Sending build context to Docker daemon 2.048kB Step 1/7 : FROM centos:7 ---> 67fa590cfc1c Step 2/7 : MAINTAINER myself <[email protected]> ---> Running in 32fadbd19ad4 Removing intermediate container 32fadbd19ad4 ---> 9786204aed0f Step 3/7 : LABEL Remarks="This is a Dockerfile for CentOS System" ---> Running in 79ce2c468c69 Removing intermediate container 79ce2c468c69 ---> 0f19ab0a7d76 Step 4/7 : RUN yum -y install epel-release ---> Running in c5072b60d0e8 CentOS-8 - AppStream 628 kB/s | 5.6 MB 00:09 CentOS-8 - Base 588 kB/s | 5.3 MB 00:09 CentOS-8 - Extras 674 B/s | 2.1 kB 00:03 Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: epel-release noarch 8-5.el8 extras 22 k Transaction Summary ================================================================================ Install 1 Package Total download size: 22 k Installed size: 30 k Downloading Packages: epel-release-8-5.el8.noarch.rpm 280 kB/s | 22 kB 00:00 -------------------------------------------------------------------------------- Total 33 kB/s | 22 kB 00:00 warning: /var/cache/dnf/extras-cbfb2f07b0021b7e/packages/epel-release-8-5.el8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY CentOS-8 - Extras 12 kB/s | 1.6 kB 00:00 Importing GPG key 0x8483C65D: Userid : "CentOS (CentOS Official Signing Key) <[email protected]>" Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D From : /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : epel-release-8-5.el8.noarch 1/1 Running scriptlet: epel-release-8-5.el8.noarch 1/1 Verifying : epel-release-8-5.el8.noarch 1/1 Installed: epel-release-8-5.el8.noarch Complete! Removing intermediate container c5072b60d0e8 ---> d48b0b1303de Step 5/7 : RUN yum -y update ---> Running in 77666cceebdb Extra Packages for Enterprise Linux 8 - x86_64 316 kB/s | 1.8 MB 00:05 Last metadata expiration check: 0:00:02 ago on Wed Oct 2 02:52:56 2019. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Upgrading: bind-export-libs x86_64 32:9.11.4-17.P2.el8_0.1 BaseOS 1.1 M iptables-libs x86_64 1.8.2-9.el8_0.1 BaseOS 97 k kmod x86_64 25-11.el8_0.2 BaseOS 127 k kmod-libs x86_64 25-11.el8_0.2 BaseOS 69 k libdnf x86_64 0.22.5-5.el8_0 BaseOS 574 k p11-kit x86_64 0.23.14-5.el8_0 BaseOS 272 k p11-kit-trust x86_64 0.23.14-5.el8_0 BaseOS 139 k platform-python x86_64 3.6.8-2.el8_0.0.1 BaseOS 79 k python3-hawkey x86_64 0.22.5-5.el8_0 BaseOS 86 k python3-libdnf x86_64 0.22.5-5.el8_0 BaseOS 618 k python3-libs x86_64 3.6.8-2.el8_0.0.1 BaseOS 7.9 M setup noarch 2.12.2-2.el8 BaseOS 180 k systemd x86_64 239-13.el8_0.5 BaseOS 3.4 M systemd-libs x86_64 239-13.el8_0.5 BaseOS 551 k systemd-pam x86_64 239-13.el8_0.5 BaseOS 222 k systemd-udev x86_64 239-13.el8_0.5 BaseOS 1.3 M Installing dependencies: xkeyboard-config noarch 2.24-3.el8 AppStream 828 k kbd-legacy noarch 2.0.4-8.el8 BaseOS 481 k kbd-misc noarch 2.0.4-8.el8 BaseOS 1.4 M Installing weak dependencies: libxkbcommon x86_64 0.8.2-1.el8 AppStream 116 k diffutils x86_64 3.6-5.el8 BaseOS 359 k kbd x86_64 2.0.4-8.el8 BaseOS 392 k Transaction Summary ================================================================================ Install 6 Packages Upgrade 16 Packages Total download size: 20 M Downloading Packages: (1/22): libxkbcommon-0.8.2-1.el8.x86_64.rpm 138 kB/s | 116 kB 00:00 (2/22): xkeyboard-config-2.24-3.el8.noarch.rpm 796 kB/s | 828 kB 00:01 (3/22): diffutils-3.6-5.el8.x86_64.rpm 126 kB/s | 359 kB 00:02 (4/22): kbd-legacy-2.0.4-8.el8.noarch.rpm 258 kB/s | 481 kB 00:01 (5/22): kbd-2.0.4-8.el8.x86_64.rpm 150 kB/s | 392 kB 00:02 (6/22): iptables-libs-1.8.2-9.el8_0.1.x86_64.rp 1.1 MB/s | 97 kB 00:00 (7/22): kmod-25-11.el8_0.2.x86_64.rpm 1.2 MB/s | 127 kB 00:00 (8/22): kmod-libs-25-11.el8_0.2.x86_64.rpm 791 kB/s | 69 kB 00:00 (9/22): bind-export-libs-9.11.4-17.P2.el8_0.1.x 820 kB/s | 1.1 MB 00:01 (10/22): p11-kit-0.23.14-5.el8_0.x86_64.rpm 1.1 MB/s | 272 kB 00:00 (11/22): p11-kit-trust-0.23.14-5.el8_0.x86_64.r 436 kB/s | 139 kB 00:00 (12/22): platform-python-3.6.8-2.el8_0.0.1.x86_ 2.2 MB/s | 79 kB 00:00 (13/22): kbd-misc-2.0.4-8.el8.noarch.rpm 708 kB/s | 1.4 MB 00:02 (14/22): python3-hawkey-0.22.5-5.el8_0.x86_64.r 1.8 MB/s | 86 kB 00:00 (15/22): libdnf-0.22.5-5.el8_0.x86_64.rpm 311 kB/s | 574 kB 00:01 (16/22): python3-libdnf-0.22.5-5.el8_0.x86_64.r 612 kB/s | 618 kB 00:01 (17/22): setup-2.12.2-2.el8.noarch.rpm 232 kB/s | 180 kB 00:00 (18/22): systemd-libs-239-13.el8_0.5.x86_64.rpm 882 kB/s | 551 kB 00:00 (19/22): systemd-pam-239-13.el8_0.5.x86_64.rpm 3.1 MB/s | 222 kB 00:00 (20/22): systemd-udev-239-13.el8_0.5.x86_64.rpm 882 kB/s | 1.3 MB 00:01 (21/22): systemd-239-13.el8_0.5.x86_64.rpm 551 kB/s | 3.4 MB 00:06 (22/22): python3-libs-3.6.8-2.el8_0.0.1.x86_64. 908 kB/s | 7.9 MB 00:08 -------------------------------------------------------------------------------- Total 1.3 MB/s | 20 MB 00:15 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: python3-libs-3.6.8-2.el8_0.0.1.x86_64 1/1 Upgrading : python3-libs-3.6.8-2.el8_0.0.1.x86_64 1/38 Upgrading : platform-python-3.6.8-2.el8_0.0.1.x86_64 2/38 Running scriptlet: platform-python-3.6.8-2.el8_0.0.1.x86_64 2/38 Upgrading : libdnf-0.22.5-5.el8_0.x86_64 3/38 Upgrading : kmod-libs-25-11.el8_0.2.x86_64 4/38 Running scriptlet: kmod-libs-25-11.el8_0.2.x86_64 4/38 Upgrading : python3-libdnf-0.22.5-5.el8_0.x86_64 5/38 Upgrading : systemd-libs-239-13.el8_0.5.x86_64 6/38 Running scriptlet: systemd-libs-239-13.el8_0.5.x86_64 6/38 Upgrading : p11-kit-0.23.14-5.el8_0.x86_64 7/38 Running scriptlet: p11-kit-0.23.14-5.el8_0.x86_64 7/38 Upgrading : kmod-25-11.el8_0.2.x86_64 8/38 Upgrading : iptables-libs-1.8.2-9.el8_0.1.x86_64 9/38 Installing : kbd-misc-2.0.4-8.el8.noarch 10/38 Installing : kbd-legacy-2.0.4-8.el8.noarch 11/38 Installing : kbd-2.0.4-8.el8.x86_64 12/38 Installing : diffutils-3.6-5.el8.x86_64 13/38 Running scriptlet: diffutils-3.6-5.el8.x86_64 13/38 Installing : xkeyboard-config-2.24-3.el8.noarch 14/38 Installing : libxkbcommon-0.8.2-1.el8.x86_64 15/38 Upgrading : systemd-pam-239-13.el8_0.5.x86_64 16/38 Running scriptlet: systemd-239-13.el8_0.5.x86_64 17/38 Upgrading : systemd-239-13.el8_0.5.x86_64 17/38 Running scriptlet: systemd-239-13.el8_0.5.x86_64 17/38 Upgrading : systemd-udev-239-13.el8_0.5.x86_64 18/38 Running scriptlet: systemd-udev-239-13.el8_0.5.x86_64 18/38 Upgrading : p11-kit-trust-0.23.14-5.el8_0.x86_64 19/38 Running scriptlet: p11-kit-trust-0.23.14-5.el8_0.x86_64 19/38 Upgrading : python3-hawkey-0.22.5-5.el8_0.x86_64 20/38 Upgrading : setup-2.12.2-2.el8.noarch 21/38 Running scriptlet: setup-2.12.2-2.el8.noarch 21/38 warning: /etc/shadow created as /etc/shadow.rpmnew Upgrading : bind-export-libs-32:9.11.4-17.P2.el8_0.1.x86_64 22/38 Running scriptlet: bind-export-libs-32:9.11.4-17.P2.el8_0.1.x86_64 22/38 Cleanup : systemd-udev-239-13.el8.x86_64 23/38 Running scriptlet: systemd-udev-239-13.el8.x86_64 23/38 Running scriptlet: systemd-239-13.el8.x86_64 24/38 Cleanup : systemd-239-13.el8.x86_64 24/38 Cleanup : python3-hawkey-0.22.5-4.el8.x86_64 25/38 Cleanup : python3-libdnf-0.22.5-4.el8.x86_64 26/38 Cleanup : python3-libs-3.6.8-1.el8.0.1.x86_64 27/38 Cleanup : platform-python-3.6.8-1.el8.0.1.x86_64 28/38 Running scriptlet: platform-python-3.6.8-1.el8.0.1.x86_64 28/38 Cleanup : p11-kit-trust-0.23.14-4.el8.x86_64 29/38 Running scriptlet: p11-kit-trust-0.23.14-4.el8.x86_64 29/38 Cleanup : setup-2.12.2-1.el8.noarch 30/38 Cleanup : p11-kit-0.23.14-4.el8.x86_64 31/38 Running scriptlet: p11-kit-0.23.14-4.el8.x86_64 31/38 Cleanup : libdnf-0.22.5-4.el8.x86_64 32/38 Cleanup : iptables-libs-1.8.2-9.el8.x86_64 33/38 Cleanup : kmod-libs-25-11.el8.x86_64 34/38 Running scriptlet: kmod-libs-25-11.el8.x86_64 34/38 Cleanup : systemd-libs-239-13.el8.x86_64 35/38 Cleanup : systemd-pam-239-13.el8.x86_64 36/38 Cleanup : kmod-25-11.el8.x86_64 37/38 Cleanup : bind-export-libs-32:9.11.4-16.P2.el8.x86_64 38/38 Running scriptlet: bind-export-libs-32:9.11.4-16.P2.el8.x86_64 38/38 Running scriptlet: systemd-239-13.el8_0.5.x86_64 38/38 Running scriptlet: systemd-udev-239-13.el8_0.5.x86_64 38/38 Verifying : libxkbcommon-0.8.2-1.el8.x86_64 1/38 Verifying : xkeyboard-config-2.24-3.el8.noarch 2/38 Verifying : diffutils-3.6-5.el8.x86_64 3/38 Verifying : kbd-2.0.4-8.el8.x86_64 4/38 Verifying : kbd-legacy-2.0.4-8.el8.noarch 5/38 Verifying : kbd-misc-2.0.4-8.el8.noarch 6/38 Verifying : bind-export-libs-32:9.11.4-17.P2.el8_0.1.x86_64 7/38 Verifying : bind-export-libs-32:9.11.4-16.P2.el8.x86_64 8/38 Verifying : iptables-libs-1.8.2-9.el8_0.1.x86_64 9/38 Verifying : iptables-libs-1.8.2-9.el8.x86_64 10/38 Verifying : kmod-25-11.el8_0.2.x86_64 11/38 Verifying : kmod-25-11.el8.x86_64 12/38 Verifying : kmod-libs-25-11.el8_0.2.x86_64 13/38 Verifying : kmod-libs-25-11.el8.x86_64 14/38 Verifying : libdnf-0.22.5-5.el8_0.x86_64 15/38 Verifying : libdnf-0.22.5-4.el8.x86_64 16/38 Verifying : p11-kit-0.23.14-5.el8_0.x86_64 17/38 Verifying : p11-kit-0.23.14-4.el8.x86_64 18/38 Verifying : p11-kit-trust-0.23.14-5.el8_0.x86_64 19/38 Verifying : p11-kit-trust-0.23.14-4.el8.x86_64 20/38 Verifying : platform-python-3.6.8-2.el8_0.0.1.x86_64 21/38 Verifying : platform-python-3.6.8-1.el8.0.1.x86_64 22/38 Verifying : python3-hawkey-0.22.5-5.el8_0.x86_64 23/38 Verifying : python3-hawkey-0.22.5-4.el8.x86_64 24/38 Verifying : python3-libdnf-0.22.5-5.el8_0.x86_64 25/38 Verifying : python3-libdnf-0.22.5-4.el8.x86_64 26/38 Verifying : python3-libs-3.6.8-2.el8_0.0.1.x86_64 27/38 Verifying : python3-libs-3.6.8-1.el8.0.1.x86_64 28/38 Verifying : setup-2.12.2-2.el8.noarch 29/38 Verifying : setup-2.12.2-1.el8.noarch 30/38 Verifying : systemd-239-13.el8_0.5.x86_64 31/38 Verifying : systemd-239-13.el8.x86_64 32/38 Verifying : systemd-libs-239-13.el8_0.5.x86_64 33/38 Verifying : systemd-libs-239-13.el8.x86_64 34/38 Verifying : systemd-pam-239-13.el8_0.5.x86_64 35/38 Verifying : systemd-pam-239-13.el8.x86_64 36/38 Verifying : systemd-udev-239-13.el8_0.5.x86_64 37/38 Verifying : systemd-udev-239-13.el8.x86_64 38/38 Upgraded: bind-export-libs-32:9.11.4-17.P2.el8_0.1.x86_64 iptables-libs-1.8.2-9.el8_0.1.x86_64 kmod-25-11.el8_0.2.x86_64 kmod-libs-25-11.el8_0.2.x86_64 libdnf-0.22.5-5.el8_0.x86_64 p11-kit-0.23.14-5.el8_0.x86_64 p11-kit-trust-0.23.14-5.el8_0.x86_64 platform-python-3.6.8-2.el8_0.0.1.x86_64 python3-hawkey-0.22.5-5.el8_0.x86_64 python3-libdnf-0.22.5-5.el8_0.x86_64 python3-libs-3.6.8-2.el8_0.0.1.x86_64 setup-2.12.2-2.el8.noarch systemd-239-13.el8_0.5.x86_64 systemd-libs-239-13.el8_0.5.x86_64 systemd-pam-239-13.el8_0.5.x86_64 systemd-udev-239-13.el8_0.5.x86_64 Installed: libxkbcommon-0.8.2-1.el8.x86_64 diffutils-3.6-5.el8.x86_64 kbd-2.0.4-8.el8.x86_64 xkeyboard-config-2.24-3.el8.noarch kbd-legacy-2.0.4-8.el8.noarch kbd-misc-2.0.4-8.el8.noarch Complete! Removing intermediate container 77666cceebdb ---> fe210f1d003c Step 6/7 : RUN yum -y install nginx ---> Running in 4283de4209bf Last metadata expiration check: 0:08:54 ago on Wed Oct 2 02:52:56 2019. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: nginx x86_64 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream 569 k Installing dependencies: gd x86_64 2.2.5-6.el8 AppStream 144 k jbigkit-libs x86_64 2.1-14.el8 AppStream 55 k libX11 x86_64 1.6.7-1.el8 AppStream 612 k libX11-common noarch 1.6.7-1.el8 AppStream 157 k libXau x86_64 1.0.8-13.el8 AppStream 36 k libXpm x86_64 3.5.12-7.el8 AppStream 58 k libjpeg-turbo x86_64 1.5.3-7.el8 AppStream 155 k libtiff x86_64 4.0.9-13.el8 AppStream 188 k libwebp x86_64 1.0.0-1.el8 AppStream 273 k libxcb x86_64 1.13-5.el8 AppStream 230 k nginx-all-modules noarch 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream 23 k nginx-filesystem noarch 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream 24 k nginx-mod-http-image-filter x86_64 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream 34 k nginx-mod-http-perl x86_64 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream 45 k nginx-mod-http-xslt-filter x86_64 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream 33 k nginx-mod-mail x86_64 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream 64 k nginx-mod-stream x86_64 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream 85 k dejavu-fonts-common noarch 2.35-6.el8 BaseOS 74 k dejavu-sans-fonts noarch 2.35-6.el8 BaseOS 1.5 M fontconfig x86_64 2.13.1-3.el8 BaseOS 275 k fontpackages-filesystem noarch 1.44-22.el8 BaseOS 16 k freetype x86_64 2.9.1-4.el8 BaseOS 393 k libpng x86_64 2:1.6.34-5.el8 BaseOS 126 k libxslt x86_64 1.1.32-3.el8 BaseOS 249 k openssl x86_64 1:1.1.1-8.el8 BaseOS 664 k perl-Carp noarch 1.42-396.el8 BaseOS 30 k perl-Errno x86_64 1.28-416.el8 BaseOS 76 k perl-Exporter noarch 5.72-396.el8 BaseOS 34 k perl-File-Path noarch 2.15-2.el8 BaseOS 38 k perl-IO x86_64 1.38-416.el8 BaseOS 141 k perl-PathTools x86_64 3.74-1.el8 BaseOS 90 k perl-Scalar-List-Utils x86_64 3:1.49-2.el8 BaseOS 68 k perl-Socket x86_64 4:2.027-2.el8 BaseOS 59 k perl-Text-Tabs+Wrap noarch 2013.0523-395.el8 BaseOS 24 k perl-Unicode-Normalize x86_64 1.25-396.el8 BaseOS 82 k perl-constant noarch 1.33-396.el8 BaseOS 25 k perl-interpreter x86_64 4:5.26.3-416.el8 BaseOS 6.3 M perl-libs x86_64 4:5.26.3-416.el8 BaseOS 1.6 M perl-macros x86_64 4:5.26.3-416.el8 BaseOS 72 k perl-parent noarch 1:0.237-1.el8 BaseOS 20 k perl-threads x86_64 1:2.21-2.el8 BaseOS 61 k perl-threads-shared x86_64 1.58-2.el8 BaseOS 48 k Enabling module streams: nginx 1.14 Transaction Summary ================================================================================ Install 43 Packages Total download size: 15 M Installed size: 38 M Downloading Packages: (1/43): jbigkit-libs-2.1-14.el8.x86_64.rpm 33 kB/s | 55 kB 00:01 (2/43): gd-2.2.5-6.el8.x86_64.rpm 84 kB/s | 144 kB 00:01 (3/43): libXau-1.0.8-13.el8.x86_64.rpm 775 kB/s | 36 kB 00:00 (4/43): libX11-common-1.6.7-1.el8.noarch.rpm 1.3 MB/s | 157 kB 00:00 (5/43): libXpm-3.5.12-7.el8.x86_64.rpm 954 kB/s | 58 kB 00:00 (6/43): libjpeg-turbo-1.5.3-7.el8.x86_64.rpm 939 kB/s | 155 kB 00:00 (7/43): libX11-1.6.7-1.el8.x86_64.rpm 307 kB/s | 612 kB 00:01 (8/43): libwebp-1.0.0-1.el8.x86_64.rpm 2.6 MB/s | 273 kB 00:00 (9/43): libxcb-1.13-5.el8.x86_64.rpm 1.8 MB/s | 230 kB 00:00 (10/43): libtiff-4.0.9-13.el8.x86_64.rpm 519 kB/s | 188 kB 00:00 (11/43): nginx-all-modules-1.14.1-8.module_el8. 243 kB/s | 23 kB 00:00 (12/43): nginx-filesystem-1.14.1-8.module_el8.0 272 kB/s | 24 kB 00:00 (13/43): nginx-mod-http-image-filter-1.14.1-8.m 491 kB/s | 34 kB 00:00 (14/43): nginx-mod-http-xslt-filter-1.14.1-8.mo 854 kB/s | 33 kB 00:00 (15/43): nginx-mod-http-perl-1.14.1-8.module_el 850 kB/s | 45 kB 00:00 (16/43): nginx-mod-mail-1.14.1-8.module_el8.0.0 1.1 MB/s | 64 kB 00:00 (17/43): nginx-1.14.1-8.module_el8.0.0+5+258f65 1.1 MB/s | 569 kB 00:00 (18/43): nginx-mod-stream-1.14.1-8.module_el8.0 211 kB/s | 85 kB 00:00 (19/43): dejavu-fonts-common-2.35-6.el8.noarch. 60 kB/s | 74 kB 00:01 (20/43): fontconfig-2.13.1-3.el8.x86_64.rpm 281 kB/s | 275 kB 00:00 (21/43): fontpackages-filesystem-1.44-22.el8.no 61 kB/s | 16 kB 00:00 (22/43): libpng-1.6.34-5.el8.x86_64.rpm 323 kB/s | 126 kB 00:00 (23/43): freetype-2.9.1-4.el8.x86_64.rpm 474 kB/s | 393 kB 00:00 (24/43): libxslt-1.1.32-3.el8.x86_64.rpm 407 kB/s | 249 kB 00:00 (25/43): perl-Carp-1.42-396.el8.noarch.rpm 126 kB/s | 30 kB 00:00 (26/43): openssl-1.1.1-8.el8.x86_64.rpm 784 kB/s | 664 kB 00:00 (27/43): perl-Errno-1.28-416.el8.x86_64.rpm 260 kB/s | 76 kB 00:00 (28/43): perl-Exporter-5.72-396.el8.noarch.rpm 169 kB/s | 34 kB 00:00 (29/43): perl-File-Path-2.15-2.el8.noarch.rpm 120 kB/s | 38 kB 00:00 (30/43): perl-IO-1.38-416.el8.x86_64.rpm 499 kB/s | 141 kB 00:00 (31/43): dejavu-sans-fonts-2.35-6.el8.noarch.rp 420 kB/s | 1.5 MB 00:03 (32/43): perl-PathTools-3.74-1.el8.x86_64.rpm 188 kB/s | 90 kB 00:00 (33/43): perl-Scalar-List-Utils-1.49-2.el8.x86_ 170 kB/s | 68 kB 00:00 (34/43): perl-Socket-2.027-2.el8.x86_64.rpm 144 kB/s | 59 kB 00:00 (35/43): perl-Text-Tabs+Wrap-2013.0523-395.el8. 49 kB/s | 24 kB 00:00 (36/43): perl-Unicode-Normalize-1.25-396.el8.x8 181 kB/s | 82 kB 00:00 (37/43): perl-constant-1.33-396.el8.noarch.rpm 22 kB/s | 25 kB 00:01 (38/43): perl-macros-5.26.3-416.el8.x86_64.rpm 94 kB/s | 72 kB 00:00 (39/43): perl-parent-0.237-1.el8.noarch.rpm 108 kB/s | 20 kB 00:00 (40/43): perl-libs-5.26.3-416.el8.x86_64.rpm 701 kB/s | 1.6 MB 00:02 (41/43): perl-threads-2.21-2.el8.x86_64.rpm 122 kB/s | 61 kB 00:00 (42/43): perl-threads-shared-1.58-2.el8.x86_64. 66 kB/s | 48 kB 00:00 (43/43): perl-interpreter-5.26.3-416.el8.x86_64 708 kB/s | 6.3 MB 00:09 -------------------------------------------------------------------------------- Total 777 kB/s | 15 MB 00:19 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : perl-Exporter-5.72-396.el8.noarch 1/43 Installing : perl-libs-4:5.26.3-416.el8.x86_64 2/43 Installing : perl-Carp-1.42-396.el8.noarch 3/43 Installing : perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 4/43 Installing : libpng-2:1.6.34-5.el8.x86_64 5/43 Installing : freetype-2.9.1-4.el8.x86_64 6/43 Installing : fontpackages-filesystem-1.44-22.el8.noarch 7/43 Installing : libjpeg-turbo-1.5.3-7.el8.x86_64 8/43 Installing : dejavu-fonts-common-2.35-6.el8.noarch 9/43 Installing : dejavu-sans-fonts-2.35-6.el8.noarch 10/43 Installing : fontconfig-2.13.1-3.el8.x86_64 11/43 Running scriptlet: fontconfig-2.13.1-3.el8.x86_64 11/43 Installing : perl-macros-4:5.26.3-416.el8.x86_64 12/43 Installing : perl-parent-1:0.237-1.el8.noarch 13/43 Installing : perl-Errno-1.28-416.el8.x86_64 14/43 Installing : perl-Socket-4:2.027-2.el8.x86_64 15/43 Installing : perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch 16/43 Installing : perl-Unicode-Normalize-1.25-396.el8.x86_64 17/43 Installing : perl-File-Path-2.15-2.el8.noarch 18/43 Installing : perl-IO-1.38-416.el8.x86_64 19/43 Installing : perl-PathTools-3.74-1.el8.x86_64 20/43 Installing : perl-constant-1.33-396.el8.noarch 21/43 Installing : perl-threads-1:2.21-2.el8.x86_64 22/43 Installing : perl-threads-shared-1.58-2.el8.x86_64 23/43 Installing : perl-interpreter-4:5.26.3-416.el8.x86_64 24/43 Installing : openssl-1:1.1.1-8.el8.x86_64 25/43 Installing : libxslt-1.1.32-3.el8.x86_64 26/43 Running scriptlet: nginx-filesystem-1:1.14.1-8.module_el8.0.0+5+258f6 27/43 Installing : nginx-filesystem-1:1.14.1-8.module_el8.0.0+5+258f6 27/43 Installing : libwebp-1.0.0-1.el8.x86_64 28/43 Installing : libXau-1.0.8-13.el8.x86_64 29/43 Installing : libxcb-1.13-5.el8.x86_64 30/43 Installing : libX11-common-1.6.7-1.el8.noarch 31/43 Installing : libX11-1.6.7-1.el8.x86_64 32/43 Installing : libXpm-3.5.12-7.el8.x86_64 33/43 Installing : jbigkit-libs-2.1-14.el8.x86_64 34/43 Running scriptlet: jbigkit-libs-2.1-14.el8.x86_64 34/43 Installing : libtiff-4.0.9-13.el8.x86_64 35/43 Installing : gd-2.2.5-6.el8.x86_64 36/43 Running scriptlet: gd-2.2.5-6.el8.x86_64 36/43 Installing : nginx-mod-http-perl-1:1.14.1-8.module_el8.0.0+5+25 37/43 Running scriptlet: nginx-mod-http-perl-1:1.14.1-8.module_el8.0.0+5+25 37/43 Installing : nginx-mod-http-xslt-filter-1:1.14.1-8.module_el8.0 38/43 Running scriptlet: nginx-mod-http-xslt-filter-1:1.14.1-8.module_el8.0 38/43 Installing : nginx-mod-mail-1:1.14.1-8.module_el8.0.0+5+258f653 39/43 Running scriptlet: nginx-mod-mail-1:1.14.1-8.module_el8.0.0+5+258f653 39/43 Installing : nginx-mod-stream-1:1.14.1-8.module_el8.0.0+5+258f6 40/43 Running scriptlet: nginx-mod-stream-1:1.14.1-8.module_el8.0.0+5+258f6 40/43 Installing : nginx-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64 41/43 Running scriptlet: nginx-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64 41/43 Installing : nginx-mod-http-image-filter-1:1.14.1-8.module_el8. 42/43 Running scriptlet: nginx-mod-http-image-filter-1:1.14.1-8.module_el8. 42/43 Installing : nginx-all-modules-1:1.14.1-8.module_el8.0.0+5+258f 43/43 Running scriptlet: nginx-all-modules-1:1.14.1-8.module_el8.0.0+5+258f 43/43 Running scriptlet: fontconfig-2.13.1-3.el8.x86_64 43/43 Verifying : gd-2.2.5-6.el8.x86_64 1/43 Verifying : jbigkit-libs-2.1-14.el8.x86_64 2/43 Verifying : libX11-1.6.7-1.el8.x86_64 3/43 Verifying : libX11-common-1.6.7-1.el8.noarch 4/43 Verifying : libXau-1.0.8-13.el8.x86_64 5/43 Verifying : libXpm-3.5.12-7.el8.x86_64 6/43 Verifying : libjpeg-turbo-1.5.3-7.el8.x86_64 7/43 Verifying : libtiff-4.0.9-13.el8.x86_64 8/43 Verifying : libwebp-1.0.0-1.el8.x86_64 9/43 Verifying : libxcb-1.13-5.el8.x86_64 10/43 Verifying : nginx-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64 11/43 Verifying : nginx-all-modules-1:1.14.1-8.module_el8.0.0+5+258f 12/43 Verifying : nginx-filesystem-1:1.14.1-8.module_el8.0.0+5+258f6 13/43 Verifying : nginx-mod-http-image-filter-1:1.14.1-8.module_el8. 14/43 Verifying : nginx-mod-http-perl-1:1.14.1-8.module_el8.0.0+5+25 15/43 Verifying : nginx-mod-http-xslt-filter-1:1.14.1-8.module_el8.0 16/43 Verifying : nginx-mod-mail-1:1.14.1-8.module_el8.0.0+5+258f653 17/43 Verifying : nginx-mod-stream-1:1.14.1-8.module_el8.0.0+5+258f6 18/43 Verifying : dejavu-fonts-common-2.35-6.el8.noarch 19/43 Verifying : dejavu-sans-fonts-2.35-6.el8.noarch 20/43 Verifying : fontconfig-2.13.1-3.el8.x86_64 21/43 Verifying : fontpackages-filesystem-1.44-22.el8.noarch 22/43 Verifying : freetype-2.9.1-4.el8.x86_64 23/43 Verifying : libpng-2:1.6.34-5.el8.x86_64 24/43 Verifying : libxslt-1.1.32-3.el8.x86_64 25/43 Verifying : openssl-1:1.1.1-8.el8.x86_64 26/43 Verifying : perl-Carp-1.42-396.el8.noarch 27/43 Verifying : perl-Errno-1.28-416.el8.x86_64 28/43 Verifying : perl-Exporter-5.72-396.el8.noarch 29/43 Verifying : perl-File-Path-2.15-2.el8.noarch 30/43 Verifying : perl-IO-1.38-416.el8.x86_64 31/43 Verifying : perl-PathTools-3.74-1.el8.x86_64 32/43 Verifying : perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 33/43 Verifying : perl-Socket-4:2.027-2.el8.x86_64 34/43 Verifying : perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch 35/43 Verifying : perl-Unicode-Normalize-1.25-396.el8.x86_64 36/43 Verifying : perl-constant-1.33-396.el8.noarch 37/43 Verifying : perl-interpreter-4:5.26.3-416.el8.x86_64 38/43 Verifying : perl-libs-4:5.26.3-416.el8.x86_64 39/43 Verifying : perl-macros-4:5.26.3-416.el8.x86_64 40/43 Verifying : perl-parent-1:0.237-1.el8.noarch 41/43 Verifying : perl-threads-1:2.21-2.el8.x86_64 42/43 Verifying : perl-threads-shared-1.58-2.el8.x86_64 43/43 Installed: nginx-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64 gd-2.2.5-6.el8.x86_64 jbigkit-libs-2.1-14.el8.x86_64 libX11-1.6.7-1.el8.x86_64 libX11-common-1.6.7-1.el8.noarch libXau-1.0.8-13.el8.x86_64 libXpm-3.5.12-7.el8.x86_64 libjpeg-turbo-1.5.3-7.el8.x86_64 libtiff-4.0.9-13.el8.x86_64 libwebp-1.0.0-1.el8.x86_64 libxcb-1.13-5.el8.x86_64 nginx-all-modules-1:1.14.1-8.module_el8.0.0+5+258f653c.noarch nginx-filesystem-1:1.14.1-8.module_el8.0.0+5+258f653c.noarch nginx-mod-http-image-filter-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64 nginx-mod-http-perl-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64 nginx-mod-http-xslt-filter-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64 nginx-mod-mail-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64 nginx-mod-stream-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64 dejavu-fonts-common-2.35-6.el8.noarch dejavu-sans-fonts-2.35-6.el8.noarch fontconfig-2.13.1-3.el8.x86_64 fontpackages-filesystem-1.44-22.el8.noarch freetype-2.9.1-4.el8.x86_64 libpng-2:1.6.34-5.el8.x86_64 libxslt-1.1.32-3.el8.x86_64 openssl-1:1.1.1-8.el8.x86_64 perl-Carp-1.42-396.el8.noarch perl-Errno-1.28-416.el8.x86_64 perl-Exporter-5.72-396.el8.noarch perl-File-Path-2.15-2.el8.noarch perl-IO-1.38-416.el8.x86_64 perl-PathTools-3.74-1.el8.x86_64 perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 perl-Socket-4:2.027-2.el8.x86_64 perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch perl-Unicode-Normalize-1.25-396.el8.x86_64 perl-constant-1.33-396.el8.noarch perl-interpreter-4:5.26.3-416.el8.x86_64 perl-libs-4:5.26.3-416.el8.x86_64 perl-macros-4:5.26.3-416.el8.x86_64 perl-parent-1:0.237-1.el8.noarch perl-threads-1:2.21-2.el8.x86_64 perl-threads-shared-1.58-2.el8.x86_64 Complete! Removing intermediate container 4283de4209bf ---> 22f8f890e257 Step 7/7 : ENTRYPOINT ["/usr/sbin/nginx", "-g", "daemon off;"] ---> Running in 53e413ef5740 Removing intermediate container 53e413ef5740 ---> 356517c51b74 Successfully built 356517c51b74 Successfully tagged centos:7
Continue on to the next step, list the available image to check whether it exist or not after building it in the previous command execution. Execute the following command :
user@hostname:~/docker/centos-nginx$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos 7 356517c51b74 4 hours ago 452MB centos latest 0f3e07c0138f 8 hours ago 220MB nginx latest f949e7d76d63 7 days ago 126MB centos 67fa590cfc1c 6 weeks ago 202MB mysql 5.7 e1e1680ac726 7 weeks ago 373MB 62a9f311b99c 7 weeks ago 445MB mysql/mysql-cluster latest 67fd04af4b8e 2 months ago 338MB mysql/mysql-server 5.7 d1469951af27 2 months ago 262MB registry 2 f32a97de94e1 6 months ago 25.8MB user@hostname:~/docker/centos-nginx$
The correct image resulting on the previous built command process is the image with the name of ‘centos:7’. In order to access the Nginx service in the container, create it first. Creating the container is done by running the image using the following command :
docker run -d centos:7 -p 7373:80
The output of the command execution above appear as the following output :
docker ps
user@hostname:~/docker/centos-nginx$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 262e6862b144 centos:7 "/usr/sbin/nginx -g …" 8 minutes ago Up 8 minutes 0.0.0.0:7373->80/tcp quizzical_mendeleev user@hostname:~/docker/centos-nginx$
If running the image so that there is a container representing it, try to access one service of the container. It is to accessing from anywhere to port 7373 in the browser. The output of accessing the address via browser exist below :
The default port of Nginx in port 80 is mapped to another port which is in port 7373. So, accessing Nginx Webserver’s service is possible just by typing the command localhost:7373 as in the output above.