Introduction
This is another article for building a CentOS docker image. Actually, it is not only building the CentOS docker image but also update the CentOS operating system in the image. It is an article where it can be the continuation of the previous article. The previous one exist in this link with the title of ‘How to Build CentOS Docker Image using Dockerfile’. In order to know how to create a docker image, just refer to the article in this link.
The content of this article has the same steps with the previous one. But there is a different on a specific step. The main difference is in the specific content of the Dockerfile file. It is the entry part for updating the CentOS operating system after getting the CentOS base image. Furthermore, in order to describe the sequence of the steps, this article has several sections available. The first section is about creating the correct Dockerfile file for building the suitable docker image. The next section is for executing the Dockerfile file after defining it. The last section is for testing the image by running it into a docker container.
Create Dockerfile file for Building Docker Images
First of all, for building the correct image, just create a file with the name of ‘Dockerfile’. The actual content of the Dockerfile available as follows :
#Getting base image from CentOS 7 FROM centos:7 MAINTAINER myself <[email protected]> LABEL Remarks="This is a Dockerfile for CentOS System" #Update Software Repository RUN yum -y update
Comparing the content of the Dockerfile file above with the one available in this link, it is actually slight different. That differentiation lies on the additional line in the above content of Dockerfile file. That line is actually a specific line for updating the packages in the operating system. It starts the line with ‘RUN yum -y update’.
Execute the Command for Building Docker Images
After creating the necessary Dockerfile, just run the following command to build the docker image. It contains a line or a certain command pattern for building a docker image. Without further explanation, the following is the simple pattern for building the docker image :
docker build -t image_name Dockerfile_location
Using the above command pattern, just execute it for building a docker image . The execution of that command pattern available in the following example :
user@hostname:~/docker/centos$ docker build -t centos-7 . Sending build context to Docker daemon 2.048kB Step 1/4 : FROM centos:7 7: Pulling from library/centos d8d02d457314: Already exists Digest: sha256:307835c385f656ec2e2fec602cf093224173c51119bbebd602c53c3653a3d6eb Status: Downloaded newer image for centos:7 ---> 67fa590cfc1c Step 2/4 : MAINTAINER myself <[email protected]> ---> Running in 80b3a45d316b Removing intermediate container 80b3a45d316b ---> 2a8b767017be Step 3/4 : LABEL Remarks="This is a Dockerfile for CentOS System" ---> Running in e2df0beb4e61 Removing intermediate container e2df0beb4e61 ---> a53d5a11fb53 Step 4/4 : RUN yum -y update ---> Running in 6d984a4f6c09 Loaded plugins: fastestmirror, ovl Determining fastest mirrors * base: xxxxxxxx.xxx.xxxxxxxxxx.xxx.xxx * extras: xxxxxxxx.xxx.xxxxxxxxxx.xxx.xxx * updates: xxxxxxxx.xxx.xxxxxxxxxx.xxx.xxx Resolving Dependencies --> Running transaction check ---> Package audit-libs.x86_64 0:2.8.4-4.el7 will be updated ---> Package audit-libs.x86_64 0:2.8.5-4.el7 will be an update ---> Package bash.x86_64 0:4.2.46-31.el7 will be updated ---> Package bash.x86_64 0:4.2.46-33.el7 will be an update ---> Package bind-license.noarch 32:9.9.4-74.el7_6.2 will be updated ---> Package bind-license.noarch 32:9.11.4-9.P2.el7 will be an update ---> Package binutils.x86_64 0:2.27-34.base.el7 will be updated ---> Package binutils.x86_64 0:2.27-41.base.el7 will be an update ---> Package centos-release.x86_64 0:7-6.1810.2.el7.centos will be updated ---> Package centos-release.x86_64 0:7-7.1908.0.el7.centos will be an update ---> Package coreutils.x86_64 0:8.22-23.el7 will be updated ---> Package coreutils.x86_64 0:8.22-24.el7 will be an update ---> Package cryptsetup-libs.x86_64 0:2.0.3-3.el7 will be updated ---> Package cryptsetup-libs.x86_64 0:2.0.3-5.el7 will be an update ---> Package curl.x86_64 0:7.29.0-51.el7_6.3 will be updated ---> Package curl.x86_64 0:7.29.0-54.el7 will be an update ---> Package device-mapper.x86_64 7:1.02.149-10.el7_6.8 will be updated ---> Package device-mapper.x86_64 7:1.02.158-2.el7 will be an update ---> Package device-mapper-libs.x86_64 7:1.02.149-10.el7_6.8 will be updated ---> Package device-mapper-libs.x86_64 7:1.02.158-2.el7 will be an update ---> Package diffutils.x86_64 0:3.3-4.el7 will be updated ---> Package diffutils.x86_64 0:3.3-5.el7 will be an update ---> Package dracut.x86_64 0:033-554.el7 will be updated ---> Package dracut.x86_64 0:033-564.el7 will be an update ---> Package elfutils-default-yama-scope.noarch 0:0.172-2.el7 will be updated ---> Package elfutils-default-yama-scope.noarch 0:0.176-2.el7 will be an update ---> Package elfutils-libelf.x86_64 0:0.172-2.el7 will be updated ---> Package elfutils-libelf.x86_64 0:0.176-2.el7 will be an update ---> Package elfutils-libs.x86_64 0:0.172-2.el7 will be updated ---> Package elfutils-libs.x86_64 0:0.176-2.el7 will be an update ---> Package glib2.x86_64 0:2.56.1-4.el7_6 will be updated ---> Package glib2.x86_64 0:2.56.1-5.el7 will be an update ---> Package glibc.x86_64 0:2.17-260.el7_6.6 will be updated ---> Package glibc.x86_64 0:2.17-292.el7 will be an update ---> Package glibc-common.x86_64 0:2.17-260.el7_6.6 will be updated ---> Package glibc-common.x86_64 0:2.17-292.el7 will be an update ---> Package kmod.x86_64 0:20-23.el7 will be updated ---> Package kmod.x86_64 0:20-25.el7 will be an update ---> Package kmod-libs.x86_64 0:20-23.el7 will be updated ---> Package kmod-libs.x86_64 0:20-25.el7 will be an update ---> Package kpartx.x86_64 0:0.4.9-123.el7 will be updated ---> Package kpartx.x86_64 0:0.4.9-127.el7 will be an update ---> Package krb5-libs.x86_64 0:1.15.1-37.el7_6 will be updated ---> Package krb5-libs.x86_64 0:1.15.1-37.el7_7.2 will be an update ---> Package libblkid.x86_64 0:2.23.2-59.el7_6.1 will be updated ---> Package libblkid.x86_64 0:2.23.2-61.el7 will be an update ---> Package libcap.x86_64 0:2.22-9.el7 will be updated ---> Package libcap.x86_64 0:2.22-10.el7 will be an update ---> Package libcom_err.x86_64 0:1.42.9-13.el7 will be updated ---> Package libcom_err.x86_64 0:1.42.9-16.el7 will be an update ---> Package libcurl.x86_64 0:7.29.0-51.el7_6.3 will be updated ---> Package libcurl.x86_64 0:7.29.0-54.el7 will be an update ---> Package libdb.x86_64 0:5.3.21-24.el7 will be updated ---> Package libdb.x86_64 0:5.3.21-25.el7 will be an update ---> Package libdb-utils.x86_64 0:5.3.21-24.el7 will be updated ---> Package libdb-utils.x86_64 0:5.3.21-25.el7 will be an update ---> Package libgcc.x86_64 0:4.8.5-36.el7_6.2 will be updated ---> Package libgcc.x86_64 0:4.8.5-39.el7 will be an update ---> Package libmount.x86_64 0:2.23.2-59.el7_6.1 will be updated ---> Package libmount.x86_64 0:2.23.2-61.el7 will be an update ---> Package libsmartcols.x86_64 0:2.23.2-59.el7_6.1 will be updated ---> Package libsmartcols.x86_64 0:2.23.2-61.el7 will be an update ---> Package libssh2.x86_64 0:1.4.3-12.el7_6.3 will be updated ---> Package libssh2.x86_64 0:1.8.0-3.el7 will be an update ---> Package libstdc++.x86_64 0:4.8.5-36.el7_6.2 will be updated ---> Package libstdc++.x86_64 0:4.8.5-39.el7 will be an update ---> Package libuuid.x86_64 0:2.23.2-59.el7_6.1 will be updated ---> Package libuuid.x86_64 0:2.23.2-61.el7 will be an update ---> Package lz4.x86_64 0:1.7.5-2.el7 will be updated ---> Package lz4.x86_64 0:1.7.5-3.el7 will be an update ---> Package nspr.x86_64 0:4.19.0-1.el7_5 will be updated ---> Package nspr.x86_64 0:4.21.0-1.el7 will be an update ---> Package nss.x86_64 0:3.36.0-7.1.el7_6 will be updated ---> Package nss.x86_64 0:3.44.0-4.el7 will be an update ---> Package nss-pem.x86_64 0:1.0.3-5.el7_6.1 will be updated ---> Package nss-pem.x86_64 0:1.0.3-7.el7 will be an update ---> Package nss-softokn.x86_64 0:3.36.0-5.el7_5 will be updated ---> Package nss-softokn.x86_64 0:3.44.0-5.el7 will be an update ---> Package nss-softokn-freebl.x86_64 0:3.36.0-5.el7_5 will be updated ---> Package nss-softokn-freebl.x86_64 0:3.44.0-5.el7 will be an update ---> Package nss-sysinit.x86_64 0:3.36.0-7.1.el7_6 will be updated ---> Package nss-sysinit.x86_64 0:3.44.0-4.el7 will be an update ---> Package nss-tools.x86_64 0:3.36.0-7.1.el7_6 will be updated ---> Package nss-tools.x86_64 0:3.44.0-4.el7 will be an update ---> Package nss-util.x86_64 0:3.36.0-1.1.el7_6 will be updated ---> Package nss-util.x86_64 0:3.44.0-3.el7 will be an update ---> Package openssl-libs.x86_64 1:1.0.2k-16.el7_6.1 will be updated ---> Package openssl-libs.x86_64 1:1.0.2k-19.el7 will be an update ---> Package passwd.x86_64 0:0.79-4.el7 will be updated ---> Package passwd.x86_64 0:0.79-5.el7 will be an update ---> Package procps-ng.x86_64 0:3.3.10-23.el7 will be updated ---> Package procps-ng.x86_64 0:3.3.10-26.el7 will be an update ---> Package python.x86_64 0:2.7.5-80.el7_6 will be updated ---> Package python.x86_64 0:2.7.5-86.el7 will be an update ---> Package python-chardet.noarch 0:2.2.1-1.el7_1 will be updated ---> Package python-chardet.noarch 0:2.2.1-3.el7 will be an update ---> Package python-libs.x86_64 0:2.7.5-80.el7_6 will be updated ---> Package python-libs.x86_64 0:2.7.5-86.el7 will be an update ---> Package readline.x86_64 0:6.2-10.el7 will be updated ---> Package readline.x86_64 0:6.2-11.el7 will be an update ---> Package rpm.x86_64 0:4.11.3-35.el7 will be updated ---> Package rpm.x86_64 0:4.11.3-40.el7 will be an update ---> Package rpm-build-libs.x86_64 0:4.11.3-35.el7 will be updated ---> Package rpm-build-libs.x86_64 0:4.11.3-40.el7 will be an update ---> Package rpm-libs.x86_64 0:4.11.3-35.el7 will be updated ---> Package rpm-libs.x86_64 0:4.11.3-40.el7 will be an update ---> Package rpm-python.x86_64 0:4.11.3-35.el7 will be updated ---> Package rpm-python.x86_64 0:4.11.3-40.el7 will be an update ---> Package shadow-utils.x86_64 2:4.1.5.1-25.el7_6.1 will be updated ---> Package shadow-utils.x86_64 2:4.6-5.el7 will be an update ---> Package systemd.x86_64 0:219-62.el7_6.9 will be updated ---> Package systemd.x86_64 0:219-67.el7_7.1 will be an update ---> Package systemd-libs.x86_64 0:219-62.el7_6.9 will be updated ---> Package systemd-libs.x86_64 0:219-67.el7_7.1 will be an update ---> Package util-linux.x86_64 0:2.23.2-59.el7_6.1 will be updated ---> Package util-linux.x86_64 0:2.23.2-61.el7 will be an update ---> Package vim-minimal.x86_64 2:7.4.160-6.el7_6 will be updated ---> Package vim-minimal.x86_64 2:7.4.629-6.el7 will be an update ---> Package yum.noarch 0:3.4.3-161.el7.centos will be updated ---> Package yum.noarch 0:3.4.3-163.el7.centos will be an update ---> Package yum-plugin-fastestmirror.noarch 0:1.1.31-50.el7 will be updated ---> Package yum-plugin-fastestmirror.noarch 0:1.1.31-52.el7 will be an update ---> Package yum-plugin-ovl.noarch 0:1.1.31-50.el7 will be updated ---> Package yum-plugin-ovl.noarch 0:1.1.31-52.el7 will be an update ---> Package yum-utils.noarch 0:1.1.31-50.el7 will be updated ---> Package yum-utils.noarch 0:1.1.31-52.el7 will be an update --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Updating: audit-libs x86_64 2.8.5-4.el7 base 102 k bash x86_64 4.2.46-33.el7 base 1.0 M bind-license noarch 32:9.11.4-9.P2.el7 base 88 k binutils x86_64 2.27-41.base.el7 base 5.9 M centos-release x86_64 7-7.1908.0.el7.centos base 26 k coreutils x86_64 8.22-24.el7 base 3.3 M cryptsetup-libs x86_64 2.0.3-5.el7 base 338 k curl x86_64 7.29.0-54.el7 base 270 k device-mapper x86_64 7:1.02.158-2.el7 base 294 k device-mapper-libs x86_64 7:1.02.158-2.el7 base 322 k diffutils x86_64 3.3-5.el7 base 322 k dracut x86_64 033-564.el7 base 329 k elfutils-default-yama-scope noarch 0.176-2.el7 base 33 k elfutils-libelf x86_64 0.176-2.el7 base 194 k elfutils-libs x86_64 0.176-2.el7 base 291 k glib2 x86_64 2.56.1-5.el7 base 2.5 M glibc x86_64 2.17-292.el7 base 3.6 M glibc-common x86_64 2.17-292.el7 base 11 M kmod x86_64 20-25.el7 base 122 k kmod-libs x86_64 20-25.el7 base 51 k kpartx x86_64 0.4.9-127.el7 base 78 k krb5-libs x86_64 1.15.1-37.el7_7.2 updates 805 k libblkid x86_64 2.23.2-61.el7 base 181 k libcap x86_64 2.22-10.el7 base 47 k libcom_err x86_64 1.42.9-16.el7 base 41 k libcurl x86_64 7.29.0-54.el7 base 222 k libdb x86_64 5.3.21-25.el7 base 720 k libdb-utils x86_64 5.3.21-25.el7 base 132 k libgcc x86_64 4.8.5-39.el7 base 102 k libmount x86_64 2.23.2-61.el7 base 183 k libsmartcols x86_64 2.23.2-61.el7 base 141 k libssh2 x86_64 1.8.0-3.el7 base 88 k libstdc++ x86_64 4.8.5-39.el7 base 305 k libuuid x86_64 2.23.2-61.el7 base 83 k lz4 x86_64 1.7.5-3.el7 base 99 k nspr x86_64 4.21.0-1.el7 base 127 k nss x86_64 3.44.0-4.el7 base 854 k nss-pem x86_64 1.0.3-7.el7 base 74 k nss-softokn x86_64 3.44.0-5.el7 base 329 k nss-softokn-freebl x86_64 3.44.0-5.el7 base 224 k nss-sysinit x86_64 3.44.0-4.el7 base 64 k nss-tools x86_64 3.44.0-4.el7 base 528 k nss-util x86_64 3.44.0-3.el7 base 79 k openssl-libs x86_64 1:1.0.2k-19.el7 base 1.2 M passwd x86_64 0.79-5.el7 base 105 k procps-ng x86_64 3.3.10-26.el7 base 291 k python x86_64 2.7.5-86.el7 base 95 k python-chardet noarch 2.2.1-3.el7 base 227 k python-libs x86_64 2.7.5-86.el7 base 5.6 M readline x86_64 6.2-11.el7 base 193 k rpm x86_64 4.11.3-40.el7 base 1.2 M rpm-build-libs x86_64 4.11.3-40.el7 base 107 k rpm-libs x86_64 4.11.3-40.el7 base 278 k rpm-python x86_64 4.11.3-40.el7 base 83 k shadow-utils x86_64 2:4.6-5.el7 base 1.2 M systemd x86_64 219-67.el7_7.1 updates 5.1 M systemd-libs x86_64 219-67.el7_7.1 updates 411 k util-linux x86_64 2.23.2-61.el7 base 2.0 M vim-minimal x86_64 2:7.4.629-6.el7 base 443 k yum noarch 3.4.3-163.el7.centos base 1.2 M yum-plugin-fastestmirror noarch 1.1.31-52.el7 base 34 k yum-plugin-ovl noarch 1.1.31-52.el7 base 27 k yum-utils noarch 1.1.31-52.el7 base 121 k Transaction Summary ================================================================================ Upgrade 63 Packages Total download size: 56 M Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. warning: /var/cache/yum/x86_64/7/base/packages/audit-libs-2.8.5-4.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Public key for audit-libs-2.8.5-4.el7.x86_64.rpm is not installed Public key for krb5-libs-1.15.1-37.el7_7.2.x86_64.rpm is not installed -------------------------------------------------------------------------------- Total 365 kB/s | 56 MB 02:36 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 Importing GPG key 0xF4A80EB5: Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>" Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5 Package : centos-release-7-6.1810.2.el7.centos.x86_64 (@CentOS) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 Running transaction check Running transaction test Transaction test succeeded Running transaction Updating : libgcc-4.8.5-39.el7.x86_64 1/126 Updating : bash-4.2.46-33.el7.x86_64 2/126 Updating : glibc-common-2.17-292.el7.x86_64 3/126 Updating : nss-softokn-freebl-3.44.0-5.el7.x86_64 4/126 Updating : glibc-2.17-292.el7.x86_64 5/126 warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew Updating : nspr-4.21.0-1.el7.x86_64 6/126 Updating : nss-util-3.44.0-3.el7.x86_64 7/126 Updating : audit-libs-2.8.5-4.el7.x86_64 8/126 Updating : libcap-2.22-10.el7.x86_64 9/126 Updating : libdb-5.3.21-25.el7.x86_64 10/126 Updating : elfutils-libelf-0.176-2.el7.x86_64 11/126 Updating : libuuid-2.23.2-61.el7.x86_64 12/126 Updating : libcom_err-1.42.9-16.el7.x86_64 13/126 Updating : 1:openssl-libs-1.0.2k-19.el7.x86_64 14/126 Updating : coreutils-8.22-24.el7.x86_64 15/126 Updating : krb5-libs-1.15.1-37.el7_7.2.x86_64 16/126 Updating : libblkid-2.23.2-61.el7.x86_64 17/126 Updating : libmount-2.23.2-61.el7.x86_64 18/126 Updating : diffutils-3.3-5.el7.x86_64 19/126 install-info: No such file or directory for /usr/share/info/diffutils.info Updating : nss-softokn-3.44.0-5.el7.x86_64 20/126 Updating : nss-pem-1.0.3-7.el7.x86_64 21/126 Updating : nss-sysinit-3.44.0-4.el7.x86_64 22/126 Updating : nss-3.44.0-4.el7.x86_64 23/126 Updating : lz4-1.7.5-3.el7.x86_64 24/126 Updating : glib2-2.56.1-5.el7.x86_64 25/126 Updating : 2:shadow-utils-4.6-5.el7.x86_64 26/126 Updating : binutils-2.27-41.base.el7.x86_64 27/126 install-info: No such file or directory for /usr/share/info/as.info.gz install-info: No such file or directory for /usr/share/info/binutils.info.gz install-info: No such file or directory for /usr/share/info/gprof.info.gz install-info: No such file or directory for /usr/share/info/ld.info.gz install-info: No such file or directory for /usr/share/info/standards.info.gz Updating : libssh2-1.8.0-3.el7.x86_64 28/126 Updating : libcurl-7.29.0-54.el7.x86_64 29/126 Updating : curl-7.29.0-54.el7.x86_64 30/126 Updating : libdb-utils-5.3.21-25.el7.x86_64 31/126 Updating : rpm-libs-4.11.3-40.el7.x86_64 32/126 Updating : rpm-4.11.3-40.el7.x86_64 33/126 Updating : rpm-build-libs-4.11.3-40.el7.x86_64 34/126 Updating : readline-6.2-11.el7.x86_64 35/126 Updating : python-libs-2.7.5-86.el7.x86_64 36/126 Updating : python-2.7.5-86.el7.x86_64 37/126 Updating : rpm-python-4.11.3-40.el7.x86_64 38/126 Updating : yum-plugin-fastestmirror-1.1.31-52.el7.noarch 39/126 Updating : yum-3.4.3-163.el7.centos.noarch 40/126 Updating : kmod-libs-20-25.el7.x86_64 41/126 Updating : libsmartcols-2.23.2-61.el7.x86_64 42/126 Updating : centos-release-7-7.1908.0.el7.centos.x86_64 43/126 Updating : procps-ng-3.3.10-26.el7.x86_64 44/126 Updating : util-linux-2.23.2-61.el7.x86_64 45/126 Updating : 7:device-mapper-1.02.158-2.el7.x86_64 46/126 Updating : kpartx-0.4.9-127.el7.x86_64 47/126 Updating : dracut-033-564.el7.x86_64 48/126 Updating : kmod-20-25.el7.x86_64 49/126 Updating : 7:device-mapper-libs-1.02.158-2.el7.x86_64 50/126 Updating : cryptsetup-libs-2.0.3-5.el7.x86_64 51/126 Updating : systemd-libs-219-67.el7_7.1.x86_64 52/126 Updating : elfutils-libs-0.176-2.el7.x86_64 53/126 Updating : systemd-219-67.el7_7.1.x86_64 54/126 Failed to get D-Bus connection: Operation not permitted Updating : elfutils-default-yama-scope-0.176-2.el7.noarch 55/126 Updating : yum-utils-1.1.31-52.el7.noarch 56/126 Updating : yum-plugin-ovl-1.1.31-52.el7.noarch 57/126 Updating : python-chardet-2.2.1-3.el7.noarch 58/126 Updating : passwd-0.79-5.el7.x86_64 59/126 Updating : nss-tools-3.44.0-4.el7.x86_64 60/126 Updating : 2:vim-minimal-7.4.629-6.el7.x86_64 61/126 Updating : libstdc++-4.8.5-39.el7.x86_64 62/126 Updating : 32:bind-license-9.11.4-9.P2.el7.noarch 63/126 Cleanup : procps-ng-3.3.10-23.el7.x86_64 64/126 Cleanup : util-linux-2.23.2-59.el7_6.1.x86_64 65/126 Cleanup : kpartx-0.4.9-123.el7.x86_64 66/126 Cleanup : cryptsetup-libs-2.0.3-3.el7.x86_64 67/126 Cleanup : systemd-libs-219-62.el7_6.9.x86_64 68/126 Cleanup : kmod-20-23.el7.x86_64 69/126 Cleanup : dracut-033-554.el7.x86_64 70/126 Cleanup : 7:device-mapper-libs-1.02.149-10.el7_6.8.x86_64 71/126 Cleanup : 7:device-mapper-1.02.149-10.el7_6.8.x86_64 72/126 Cleanup : elfutils-libs-0.172-2.el7.x86_64 73/126 Cleanup : elfutils-default-yama-scope-0.172-2.el7.noarch 74/126 Cleanup : systemd-219-62.el7_6.9.x86_64 75/126 Cleanup : yum-utils-1.1.31-50.el7.noarch 76/126 Cleanup : centos-release-7-6.1810.2.el7.centos.x86_64 77/126 Cleanup : yum-plugin-ovl-1.1.31-50.el7.noarch 78/126 Cleanup : yum-plugin-fastestmirror-1.1.31-50.el7.noarch 79/126 Cleanup : yum-3.4.3-161.el7.centos.noarch 80/126 Cleanup : python-chardet-2.2.1-1.el7_1.noarch 81/126 Cleanup : rpm-python-4.11.3-35.el7.x86_64 82/126 Cleanup : rpm-build-libs-4.11.3-35.el7.x86_64 83/126 Cleanup : rpm-libs-4.11.3-35.el7.x86_64 84/126 Cleanup : rpm-4.11.3-35.el7.x86_64 85/126 Cleanup : curl-7.29.0-51.el7_6.3.x86_64 86/126 Cleanup : libcurl-7.29.0-51.el7_6.3.x86_64 87/126 Cleanup : nss-tools-3.36.0-7.1.el7_6.x86_64 88/126 Cleanup : nss-pem-1.0.3-5.el7_6.1.x86_64 89/126 Cleanup : nss-sysinit-3.36.0-7.1.el7_6.x86_64 90/126 Cleanup : nss-3.36.0-7.1.el7_6.x86_64 91/126 Cleanup : nss-softokn-3.36.0-5.el7_5.x86_64 92/126 Cleanup : python-2.7.5-80.el7_6.x86_64 93/126 Cleanup : python-libs-2.7.5-80.el7_6.x86_64 94/126 Cleanup : 2:shadow-utils-4.1.5.1-25.el7_6.1.x86_64 95/126 Cleanup : passwd-0.79-4.el7.x86_64 96/126 Cleanup : glib2-2.56.1-4.el7_6.x86_64 97/126 Cleanup : libmount-2.23.2-59.el7_6.1.x86_64 98/126 Cleanup : libblkid-2.23.2-59.el7_6.1.x86_64 99/126 Cleanup : libssh2-1.4.3-12.el7_6.3.x86_64 100/126 Cleanup : libdb-utils-5.3.21-24.el7.x86_64 101/126 Cleanup : kmod-libs-20-23.el7.x86_64 102/126 Cleanup : binutils-2.27-34.base.el7.x86_64 103/126 Cleanup : krb5-libs-1.15.1-37.el7_6.x86_64 104/126 Cleanup : coreutils-8.22-23.el7.x86_64 105/126 Cleanup : 1:openssl-libs-1.0.2k-16.el7_6.1.x86_64 106/126 Cleanup : libstdc++-4.8.5-36.el7_6.2.x86_64 107/126 Cleanup : readline-6.2-10.el7.x86_64 108/126 Cleanup : diffutils-3.3-4.el7.x86_64 109/126 Cleanup : libcom_err-1.42.9-13.el7.x86_64 110/126 Cleanup : libcap-2.22-9.el7.x86_64 111/126 Cleanup : libdb-5.3.21-24.el7.x86_64 112/126 Cleanup : libuuid-2.23.2-59.el7_6.1.x86_64 113/126 Cleanup : audit-libs-2.8.4-4.el7.x86_64 114/126 Cleanup : elfutils-libelf-0.172-2.el7.x86_64 115/126 Cleanup : lz4-1.7.5-2.el7.x86_64 116/126 Cleanup : libsmartcols-2.23.2-59.el7_6.1.x86_64 117/126 Cleanup : 2:vim-minimal-7.4.160-6.el7_6.x86_64 118/126 Cleanup : 32:bind-license-9.9.4-74.el7_6.2.noarch 119/126 Cleanup : glibc-common-2.17-260.el7_6.6.x86_64 120/126 Cleanup : bash-4.2.46-31.el7.x86_64 121/126 Cleanup : nspr-4.19.0-1.el7_5.x86_64 122/126 Cleanup : nss-util-3.36.0-1.1.el7_6.x86_64 123/126 Cleanup : nss-softokn-freebl-3.36.0-5.el7_5.x86_64 124/126 Cleanup : glibc-2.17-260.el7_6.6.x86_64 125/126 Cleanup : libgcc-4.8.5-36.el7_6.2.x86_64 126/126 Verifying : yum-3.4.3-163.el7.centos.noarch 1/126 Verifying : libdb-utils-5.3.21-25.el7.x86_64 2/126 Verifying : elfutils-default-yama-scope-0.176-2.el7.noarch 3/126 Verifying : python-libs-2.7.5-86.el7.x86_64 4/126 Verifying : readline-6.2-11.el7.x86_64 5/126 Verifying : procps-ng-3.3.10-26.el7.x86_64 6/126 Verifying : libgcc-4.8.5-39.el7.x86_64 7/126 Verifying : nss-pem-1.0.3-7.el7.x86_64 8/126 Verifying : glibc-common-2.17-292.el7.x86_64 9/126 Verifying : kmod-libs-20-25.el7.x86_64 10/126 Verifying : lz4-1.7.5-3.el7.x86_64 11/126 Verifying : rpm-libs-4.11.3-40.el7.x86_64 12/126 Verifying : 7:device-mapper-1.02.158-2.el7.x86_64 13/126 Verifying : 1:openssl-libs-1.0.2k-19.el7.x86_64 14/126 Verifying : systemd-219-67.el7_7.1.x86_64 15/126 Verifying : python-chardet-2.2.1-3.el7.noarch 16/126 Verifying : libssh2-1.8.0-3.el7.x86_64 17/126 Verifying : coreutils-8.22-24.el7.x86_64 18/126 Verifying : util-linux-2.23.2-61.el7.x86_64 19/126 Verifying : nss-util-3.44.0-3.el7.x86_64 20/126 Verifying : glib2-2.56.1-5.el7.x86_64 21/126 Verifying : libuuid-2.23.2-61.el7.x86_64 22/126 Verifying : libmount-2.23.2-61.el7.x86_64 23/126 Verifying : 2:vim-minimal-7.4.629-6.el7.x86_64 24/126 Verifying : passwd-0.79-5.el7.x86_64 25/126 Verifying : nss-sysinit-3.44.0-4.el7.x86_64 26/126 Verifying : 32:bind-license-9.11.4-9.P2.el7.noarch 27/126 Verifying : nss-3.44.0-4.el7.x86_64 28/126 Verifying : yum-utils-1.1.31-52.el7.noarch 29/126 Verifying : elfutils-libs-0.176-2.el7.x86_64 30/126 Verifying : nspr-4.21.0-1.el7.x86_64 31/126 Verifying : 7:device-mapper-libs-1.02.158-2.el7.x86_64 32/126 Verifying : libsmartcols-2.23.2-61.el7.x86_64 33/126 Verifying : yum-plugin-fastestmirror-1.1.31-52.el7.noarch 34/126 Verifying : rpm-build-libs-4.11.3-40.el7.x86_64 35/126 Verifying : nss-tools-3.44.0-4.el7.x86_64 36/126 Verifying : libcom_err-1.42.9-16.el7.x86_64 37/126 Verifying : yum-plugin-ovl-1.1.31-52.el7.noarch 38/126 Verifying : 2:shadow-utils-4.6-5.el7.x86_64 39/126 Verifying : nss-softokn-freebl-3.44.0-5.el7.x86_64 40/126 Verifying : centos-release-7-7.1908.0.el7.centos.x86_64 41/126 Verifying : audit-libs-2.8.5-4.el7.x86_64 42/126 Verifying : cryptsetup-libs-2.0.3-5.el7.x86_64 43/126 Verifying : diffutils-3.3-5.el7.x86_64 44/126 Verifying : libdb-5.3.21-25.el7.x86_64 45/126 Verifying : libblkid-2.23.2-61.el7.x86_64 46/126 Verifying : systemd-libs-219-67.el7_7.1.x86_64 47/126 Verifying : rpm-4.11.3-40.el7.x86_64 48/126 Verifying : binutils-2.27-41.base.el7.x86_64 49/126 Verifying : bash-4.2.46-33.el7.x86_64 50/126 Verifying : libstdc++-4.8.5-39.el7.x86_64 51/126 Verifying : krb5-libs-1.15.1-37.el7_7.2.x86_64 52/126 Verifying : dracut-033-564.el7.x86_64 53/126 Verifying : rpm-python-4.11.3-40.el7.x86_64 54/126 Verifying : python-2.7.5-86.el7.x86_64 55/126 Verifying : kpartx-0.4.9-127.el7.x86_64 56/126 Verifying : libcap-2.22-10.el7.x86_64 57/126 Verifying : glibc-2.17-292.el7.x86_64 58/126 Verifying : libcurl-7.29.0-54.el7.x86_64 59/126 Verifying : nss-softokn-3.44.0-5.el7.x86_64 60/126 Verifying : curl-7.29.0-54.el7.x86_64 61/126 Verifying : kmod-20-25.el7.x86_64 62/126 Verifying : elfutils-libelf-0.176-2.el7.x86_64 63/126 Verifying : glib2-2.56.1-4.el7_6.x86_64 64/126 Verifying : rpm-python-4.11.3-35.el7.x86_64 65/126 Verifying : nss-pem-1.0.3-5.el7_6.1.x86_64 66/126 Verifying : libblkid-2.23.2-59.el7_6.1.x86_64 67/126 Verifying : glibc-2.17-260.el7_6.6.x86_64 68/126 Verifying : 2:shadow-utils-4.1.5.1-25.el7_6.1.x86_64 69/126 Verifying : cryptsetup-libs-2.0.3-3.el7.x86_64 70/126 Verifying : curl-7.29.0-51.el7_6.3.x86_64 71/126 Verifying : readline-6.2-10.el7.x86_64 72/126 Verifying : 2:vim-minimal-7.4.160-6.el7_6.x86_64 73/126 Verifying : python-chardet-2.2.1-1.el7_1.noarch 74/126 Verifying : nss-tools-3.36.0-7.1.el7_6.x86_64 75/126 Verifying : nspr-4.19.0-1.el7_5.x86_64 76/126 Verifying : bash-4.2.46-31.el7.x86_64 77/126 Verifying : rpm-libs-4.11.3-35.el7.x86_64 78/126 Verifying : libmount-2.23.2-59.el7_6.1.x86_64 79/126 Verifying : libstdc++-4.8.5-36.el7_6.2.x86_64 80/126 Verifying : krb5-libs-1.15.1-37.el7_6.x86_64 81/126 Verifying : nss-sysinit-3.36.0-7.1.el7_6.x86_64 82/126 Verifying : coreutils-8.22-23.el7.x86_64 83/126 Verifying : rpm-build-libs-4.11.3-35.el7.x86_64 84/126 Verifying : nss-3.36.0-7.1.el7_6.x86_64 85/126 Verifying : elfutils-libelf-0.172-2.el7.x86_64 86/126 Verifying : lz4-1.7.5-2.el7.x86_64 87/126 Verifying : elfutils-libs-0.172-2.el7.x86_64 88/126 Verifying : yum-utils-1.1.31-50.el7.noarch 89/126 Verifying : centos-release-7-6.1810.2.el7.centos.x86_64 90/126 Verifying : yum-3.4.3-161.el7.centos.noarch 91/126 Verifying : 7:device-mapper-libs-1.02.149-10.el7_6.8.x86_64 92/126 Verifying : libdb-utils-5.3.21-24.el7.x86_64 93/126 Verifying : dracut-033-554.el7.x86_64 94/126 Verifying : passwd-0.79-4.el7.x86_64 95/126 Verifying : rpm-4.11.3-35.el7.x86_64 96/126 Verifying : binutils-2.27-34.base.el7.x86_64 97/126 Verifying : systemd-libs-219-62.el7_6.9.x86_64 98/126 Verifying : libdb-5.3.21-24.el7.x86_64 99/126 Verifying : kmod-20-23.el7.x86_64 100/126 Verifying : elfutils-default-yama-scope-0.172-2.el7.noarch 101/126 Verifying : libssh2-1.4.3-12.el7_6.3.x86_64 102/126 Verifying : libsmartcols-2.23.2-59.el7_6.1.x86_64 103/126 Verifying : libuuid-2.23.2-59.el7_6.1.x86_64 104/126 Verifying : nss-softokn-freebl-3.36.0-5.el7_5.x86_64 105/126 Verifying : libcurl-7.29.0-51.el7_6.3.x86_64 106/126 Verifying : 7:device-mapper-1.02.149-10.el7_6.8.x86_64 107/126 Verifying : nss-softokn-3.36.0-5.el7_5.x86_64 108/126 Verifying : kpartx-0.4.9-123.el7.x86_64 109/126 Verifying : python-2.7.5-80.el7_6.x86_64 110/126 Verifying : util-linux-2.23.2-59.el7_6.1.x86_64 111/126 Verifying : procps-ng-3.3.10-23.el7.x86_64 112/126 Verifying : yum-plugin-ovl-1.1.31-50.el7.noarch 113/126 Verifying : nss-util-3.36.0-1.1.el7_6.x86_64 114/126 Verifying : audit-libs-2.8.4-4.el7.x86_64 115/126 Verifying : kmod-libs-20-23.el7.x86_64 116/126 Verifying : yum-plugin-fastestmirror-1.1.31-50.el7.noarch 117/126 Verifying : libgcc-4.8.5-36.el7_6.2.x86_64 118/126 Verifying : libcom_err-1.42.9-13.el7.x86_64 119/126 Verifying : libcap-2.22-9.el7.x86_64 120/126 Verifying : 32:bind-license-9.9.4-74.el7_6.2.noarch 121/126 Verifying : systemd-219-62.el7_6.9.x86_64 122/126 Verifying : python-libs-2.7.5-80.el7_6.x86_64 123/126 Verifying : 1:openssl-libs-1.0.2k-16.el7_6.1.x86_64 124/126 Verifying : diffutils-3.3-4.el7.x86_64 125/126 Verifying : glibc-common-2.17-260.el7_6.6.x86_64 126/126 Updated: audit-libs.x86_64 0:2.8.5-4.el7 bash.x86_64 0:4.2.46-33.el7 bind-license.noarch 32:9.11.4-9.P2.el7 binutils.x86_64 0:2.27-41.base.el7 centos-release.x86_64 0:7-7.1908.0.el7.centos coreutils.x86_64 0:8.22-24.el7 cryptsetup-libs.x86_64 0:2.0.3-5.el7 curl.x86_64 0:7.29.0-54.el7 device-mapper.x86_64 7:1.02.158-2.el7 device-mapper-libs.x86_64 7:1.02.158-2.el7 diffutils.x86_64 0:3.3-5.el7 dracut.x86_64 0:033-564.el7 elfutils-default-yama-scope.noarch 0:0.176-2.el7 elfutils-libelf.x86_64 0:0.176-2.el7 elfutils-libs.x86_64 0:0.176-2.el7 glib2.x86_64 0:2.56.1-5.el7 glibc.x86_64 0:2.17-292.el7 glibc-common.x86_64 0:2.17-292.el7 kmod.x86_64 0:20-25.el7 kmod-libs.x86_64 0:20-25.el7 kpartx.x86_64 0:0.4.9-127.el7 krb5-libs.x86_64 0:1.15.1-37.el7_7.2 libblkid.x86_64 0:2.23.2-61.el7 libcap.x86_64 0:2.22-10.el7 libcom_err.x86_64 0:1.42.9-16.el7 libcurl.x86_64 0:7.29.0-54.el7 libdb.x86_64 0:5.3.21-25.el7 libdb-utils.x86_64 0:5.3.21-25.el7 libgcc.x86_64 0:4.8.5-39.el7 libmount.x86_64 0:2.23.2-61.el7 libsmartcols.x86_64 0:2.23.2-61.el7 libssh2.x86_64 0:1.8.0-3.el7 libstdc++.x86_64 0:4.8.5-39.el7 libuuid.x86_64 0:2.23.2-61.el7 lz4.x86_64 0:1.7.5-3.el7 nspr.x86_64 0:4.21.0-1.el7 nss.x86_64 0:3.44.0-4.el7 nss-pem.x86_64 0:1.0.3-7.el7 nss-softokn.x86_64 0:3.44.0-5.el7 nss-softokn-freebl.x86_64 0:3.44.0-5.el7 nss-sysinit.x86_64 0:3.44.0-4.el7 nss-tools.x86_64 0:3.44.0-4.el7 nss-util.x86_64 0:3.44.0-3.el7 openssl-libs.x86_64 1:1.0.2k-19.el7 passwd.x86_64 0:0.79-5.el7 procps-ng.x86_64 0:3.3.10-26.el7 python.x86_64 0:2.7.5-86.el7 python-chardet.noarch 0:2.2.1-3.el7 python-libs.x86_64 0:2.7.5-86.el7 readline.x86_64 0:6.2-11.el7 rpm.x86_64 0:4.11.3-40.el7 rpm-build-libs.x86_64 0:4.11.3-40.el7 rpm-libs.x86_64 0:4.11.3-40.el7 rpm-python.x86_64 0:4.11.3-40.el7 shadow-utils.x86_64 2:4.6-5.el7 systemd.x86_64 0:219-67.el7_7.1 systemd-libs.x86_64 0:219-67.el7_7.1 util-linux.x86_64 0:2.23.2-61.el7 vim-minimal.x86_64 2:7.4.629-6.el7 yum.noarch 0:3.4.3-163.el7.centos yum-plugin-fastestmirror.noarch 0:1.1.31-52.el7 yum-plugin-ovl.noarch 0:1.1.31-52.el7 yum-utils.noarch 0:1.1.31-52.el7 Complete! Removing intermediate container 6d984a4f6c09 ---> 5988ae7ff8eb Successfully built 5988ae7ff8eb Successfully tagged centos-7:latest user@hostname:~/docker/centos$
At last, the process for building the docker image is done. Continue on to the next step, it is a step for testing and proving that the operating system inside the docker image is fully updated.
Running the Already Built Docker Images
First of all, check the list of the available docker image. Execute the following command :
docker images
The following is the output of the above command pattern for listing the available images in the operating system :
user@hostname:~/docker/centos$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos-7 latest 5988ae7ff8eb 3 minutes ago 412MB centos 7 67fa590cfc1c 4 weeks ago 202MB mysql 5.7 e1e1680ac726 5 weeks ago 373MB <none> <none> 62a9f311b99c 5 weeks ago 445MB mysql/mysql-cluster latest 67fd04af4b8e 8 weeks ago 338MB mysql/mysql-server 5.7 d1469951af27 2 months ago 262MB registry 2 f32a97de94e1 6 months ago 25.8MB user@hostname:~/docker/centos$
The output of the above command execution can be vary one another. It depends on the availability of the docker images. The above command execution is just a command to search for the images created in the previous section, Fortunately, according to the output of the above command execution, there is an image with the name of ‘centos-7’. It is actually the name for the docker image built in the previous section. So, in order to prove that the operating system inside the docker image is really update, just run the docker image. Executing a docker image has a specific pattern as follows :
docker run -i -t image_name /bin/bash
For an example, the execution of the above command pattern exist below :
user@hostname:~/docker/centos$ docker run -i -t centos-7 /bin/bash [root@4ba522edf4f6 /]# yum update Loaded plugins: fastestmirror, ovl Loading mirror speeds from cached hostfile * base: xxxxx.xxxxxxxxx.xxx * extras: xxxxx.xxxxxxxxx.xxx * updates: xxxxx.xxxxxxxxx.xxx No packages marked for update [root@4ba522edf4f6 /]#
As it shows in the above output command execution, there is no update available. Although there is an execution of the ‘yum update’ command, it doesn’t generate any output showing any packages for update. In other words, the update process has been successfully done in the previous step. It is already finished in the time when the docker image is built.