Install Docker
[root@clusterserver3 /]# yum -y install docker
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirror.nus.edu.sg
* extras: mirror.nus.edu.sg
* updates: mirror.nus.edu.sg
Resolving Dependencies
–> Running transaction check
—> Package docker.x86_64 0:1.8.2-10.el7.centos will be installed
–> Processing Dependency: docker-selinux >= 1.8.2-10.el7.centos for package: docker-1.8.2-10.el7.centos.x86_64
–> Running transaction check
—> Package docker-selinux.x86_64 0:1.8.2-10.el7.centos will be installed
–> Processing Dependency: policycoreutils-python for package: docker-selinux-1.8.2-10.el7.centos.x86_64
–> Running transaction check
—> Package policycoreutils-python.x86_64 0:2.2.5-20.el7 will be installed
–> Processing Dependency: libsemanage-python >= 2.1.10-1 for package: policycoreutils-python-2.2.5-20.el7.x86_64
–> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.2.5-20.el7.x86_64
–> Processing Dependency: python-IPy for package: policycoreutils-python-2.2.5-20.el7.x86_64
–> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.2.5-20.el7.x86_64
–> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.2.5-20.el7.x86_64
–> Processing Dependency: libcgroup for package: policycoreutils-python-2.2.5-20.el7.x86_64
–> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.2.5-20.el7.x86_64
–> Processing Dependency: checkpolicy for package: policycoreutils-python-2.2.5-20.el7.x86_64
–> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.2.5-20.el7.x86_64
–> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.2.5-20.el7.x86_64
–> Running transaction check
—> Package audit-libs-python.x86_64 0:2.4.1-5.el7 will be installed
—> Package checkpolicy.x86_64 0:2.1.12-6.el7 will be installed
—> Package libcgroup.x86_64 0:0.41-8.el7 will be installed
—> Package libsemanage-python.x86_64 0:2.1.10-18.el7 will be installed
—> Package python-IPy.noarch 0:0.75-6.el7 will be installed
—> Package setools-libs.x86_64 0:3.3.7-46.el7 will be installed
–> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================
Installing:
docker x86_64 1.8.2-10.el7.centos extras 10 M
Installing for dependencies:
audit-libs-python x86_64 2.4.1-5.el7 base 69 k
checkpolicy x86_64 2.1.12-6.el7 base 247 k
docker-selinux x86_64 1.8.2-10.el7.centos extras 63 k
libcgroup x86_64 0.41-8.el7 base 64 k
libsemanage-python x86_64 2.1.10-18.el7 base 94 k
policycoreutils-python x86_64 2.2.5-20.el7 base 435 k
python-IPy noarch 0.75-6.el7 base 32 k
setools-libs x86_64 3.3.7-46.el7 base 485 k
Transaction Summary
=================================================================================================================================================================================================
Install 1 Package (+8 Dependent packages)
Total download size: 12 M
Installed size: 51 M
Downloading packages:
(1/9): audit-libs-python-2.4.1-5.el7.x86_64.rpm | 69 kB 00:00:00
(2/9): libsemanage-python-2.1.10-18.el7.x86_64.rpm | 94 kB 00:00:00
(3/9): libcgroup-0.41-8.el7.x86_64.rpm | 64 kB 00:00:00
(4/9): docker-selinux-1.8.2-10.el7.centos.x86_64.rpm | 63 kB 00:00:00
(5/9): python-IPy-0.75-6.el7.noarch.rpm | 32 kB 00:00:00
(6/9): checkpolicy-2.1.12-6.el7.x86_64.rpm | 247 kB 00:00:01
(7/9): policycoreutils-python-2.2.5-20.el7.x86_64.rpm | 435 kB 00:00:02
(8/9): setools-libs-3.3.7-46.el7.x86_64.rpm | 485 kB 00:00:01
(9/9): docker-1.8.2-10.el7.centos.x86_64.rpm | 10 MB 00:00:09
————————————————————————————————————————————————————————————————-
Total 1.2 MB/s | 12 MB 00:00:09
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : audit-libs-python-2.4.1-5.el7.x86_64 1/9
Installing : libsemanage-python-2.1.10-18.el7.x86_64 2/9
Installing : python-IPy-0.75-6.el7.noarch 3/9
Installing : checkpolicy-2.1.12-6.el7.x86_64 4/9
Installing : libcgroup-0.41-8.el7.x86_64 5/9
Installing : setools-libs-3.3.7-46.el7.x86_64 6/9
Installing : policycoreutils-python-2.2.5-20.el7.x86_64 7/9
Installing : docker-selinux-1.8.2-10.el7.centos.x86_64 8/9
Installing : docker-1.8.2-10.el7.centos.x86_64 9/9
Verifying : setools-libs-3.3.7-46.el7.x86_64 1/9
Verifying : docker-selinux-1.8.2-10.el7.centos.x86_64 2/9
Verifying : libcgroup-0.41-8.el7.x86_64 3/9
Verifying : checkpolicy-2.1.12-6.el7.x86_64 4/9
Verifying : docker-1.8.2-10.el7.centos.x86_64 5/9
Verifying : python-IPy-0.75-6.el7.noarch 6/9
Verifying : libsemanage-python-2.1.10-18.el7.x86_64 7/9
Verifying : policycoreutils-python-2.2.5-20.el7.x86_64 8/9
Verifying : audit-libs-python-2.4.1-5.el7.x86_64 9/9
Installed:
docker.x86_64 0:1.8.2-10.el7.centos
Dependency Installed:
audit-libs-python.x86_64 0:2.4.1-5.el7 checkpolicy.x86_64 0:2.1.12-6.el7 docker-selinux.x86_64 0:1.8.2-10.el7.centos libcgroup.x86_64 0:0.41-8.el7
libsemanage-python.x86_64 0:2.1.10-18.el7 policycoreutils-python.x86_64 0:2.2.5-20.el7 python-IPy.noarch 0:0.75-6.el7 setools-libs.x86_64 0:3.3.7-46.el7
Complete!
[root@clusterserver3 /]#
[root@clusterserver3 /]# systemctl start docker
root@clusterserver3 /]# systemctl status docker
? docker.service – Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2016-01-02 00:45:24 SGT; 4s ago
Docs: http://docs.docker.com
Main PID: 2382 (docker)
CGroup: /system.slice/docker.service
??2382 /usr/bin/docker daemon –selinux-enabled
Jan 02 00:45:24 clusterserver3.rmohan.com docker[2382]: time=”2016-01-02T00:45:24.802613004+08:00″ level=warning msg=”Docker could not enable SELinux on the host system”
Jan 02 00:45:24 clusterserver3.rmohan.com docker[2382]: time=”2016-01-02T00:45:24.812225532+08:00″ level=info msg=”Option DefaultDriver: bridge”
Jan 02 00:45:24 clusterserver3.rmohan.com docker[2382]: time=”2016-01-02T00:45:24.812247573+08:00″ level=info msg=”Option DefaultNetwork: bridge”
Jan 02 00:45:24 clusterserver3.rmohan.com docker[2382]: time=”2016-01-02T00:45:24.833117198+08:00″ level=warning msg=”Running modprobe bridge nf_nat br_netfilter failed with messa….el7.x86_64
Jan 02 00:45:24 clusterserver3.rmohan.com docker[2382]: time=”2016-01-02T00:45:24.839917218+08:00″ level=info msg=”Firewalld running: false”
Jan 02 00:45:24 clusterserver3.rmohan.com docker[2382]: time=”2016-01-02T00:45:24.929783683+08:00″ level=info msg=”Loading containers: start.”
Jan 02 00:45:24 clusterserver3.rmohan.com docker[2382]: time=”2016-01-02T00:45:24.929962936+08:00″ level=info msg=”Loading containers: done.”
Jan 02 00:45:24 clusterserver3.rmohan.com docker[2382]: time=”2016-01-02T00:45:24.929979555+08:00″ level=info msg=”Daemon has completed initialization”
Jan 02 00:45:24 clusterserver3.rmohan.com docker[2382]: time=”2016-01-02T00:45:24.929995986+08:00″ level=info msg=”Docker daemon” commit=”a01dc02/1.8.2″ execdriver=native-0.2 grap…-el7.centos
Jan 02 00:45:24 clusterserver3.rmohan.com systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.
[root@clusterserver3 /]#
Download the official image and create a Container
[root@clusterserver3 /]# docker pull centos
Using default tag: latest
Trying to pull repository docker.io/library/centos … latest: Pulling from library/centos
47d44cb6f252: Pull complete
838c1c5c4f83: Extracting [==============================================> ] 65.18 MB/70.51 MB
5764f0a31317: Download complete
60e65a8e4030: Download complete
root@clusterserver3 /]# docker pull centos
Using default tag: latest
Trying to pull repository docker.io/library/centos … latest: Pulling from library/centos
47d44cb6f252: Pull complete
838c1c5c4f83: Pull complete
5764f0a31317: Pull complete
60e65a8e4030: Pull complete
library/centos:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
Digest: sha256:8072bc7c66c3d5b633c3fddfc2bf12d5b4c2623f7004d9eed6aae70e0e99fbd7
Status: Downloaded newer image for docker.io/centos:latest
[root@clusterserver3 /]# docker run centos /bin/echo “welcome to rmohan.com in docker”
welcome to rmohan.com in docker
[root@clusterserver3 /]#
Connect to the interactive session of a Container with “i” and “t” option like follows. If exit from the Container session, the process of a Container finishes.
[root@clusterserver3 /]# docker run -i -t centos /bin/bash
[root@805a5cacc15e /]#
[root@805a5cacc15e ~]# uname -a
Linux 805a5cacc15e 3.10.0-327.3.1.el7.x86_64 #1 SMP Wed Dec 9 14:09:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@805a5cacc15e ~]#
[root@clusterserver3 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
502b544df6af centos “/bin/bash” 34 seconds ago Up 34 seconds naughty_torvalds
[root@clusterserver3 ~]#
[root@clusterserver3 ~]# docker kill 502b544df6af
[root@clusterserver3 ~]# docker ps
[root@clusterserver3 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
docker.io/centos latest 60e65a8e4030 8 days ago 196.6 MB
[root@clusterserver3 ~]#
[root@clusterserver3 /]# docker run centos /bin/bash -c “yum -y update; yum -y install httpd”
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
* base: centos.usonyx.net
* extras: centos.usonyx.net
* updates: centos.usonyx.net
No packages marked for update
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: centos.usonyx.net
* extras: centos.usonyx.net
* updates: centos.usonyx.net
Resolving Dependencies
–> Running transaction check
—> Package httpd.x86_64 0:2.4.6-40.el7.centos will be installed
–> Processing Dependency: httpd-tools = 2.4.6-40.el7.centos for package: httpd-2.4.6-40.el7.centos.x86_64
–> Processing Dependency: system-logos >= 7.92.1-1 for package: httpd-2.4.6-40.el7.centos.x86_64
–> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-40.el7.centos.x86_64
–> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-40.el7.centos.x86_64
–> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-40.el7.centos.x86_64
–> Running transaction check
—> Package apr.x86_64 0:1.4.8-3.el7 will be installed
—> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
—> Package centos-logos.noarch 0:70.0.6-3.el7.centos will be installed
—> Package httpd-tools.x86_64 0:2.4.6-40.el7.centos will be installed
—> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
–> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
httpd x86_64 2.4.6-40.el7.centos base 2.7 M
Installing for dependencies:
apr x86_64 1.4.8-3.el7 base 103 k
apr-util x86_64 1.5.2-6.el7 base 92 k
centos-logos noarch 70.0.6-3.el7.centos base 21 M
httpd-tools x86_64 2.4.6-40.el7.centos base 82 k
mailcap noarch 2.1.41-2.el7 base 31 k
Transaction Summary
================================================================================
Install 1 Package (+5 Dependent packages)
Total download size: 24 M
Installed size: 31 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/httpd-tools-2.4.6-40.el7.centos.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for httpd-tools-2.4.6-40.el7.centos.x86_64.rpm is not installed
——————————————————————————–
Total 3.8 MB/s | 24 MB 00:06
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) <security@centos.org>”
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-2.1511.el7.centos.2.10.x86_64 (@CentOS)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : apr-1.4.8-3.el7.x86_64 1/6
Installing : apr-util-1.5.2-6.el7.x86_64 2/6
Installing : httpd-tools-2.4.6-40.el7.centos.x86_64 3/6
Installing : centos-logos-70.0.6-3.el7.centos.noarch 4/6
Installing : mailcap-2.1.41-2.el7.noarch 5/6
Installing : httpd-2.4.6-40.el7.centos.x86_64 6/6
Verifying : httpd-2.4.6-40.el7.centos.x86_64 1/6
Verifying : httpd-tools-2.4.6-40.el7.centos.x86_64 2/6
Verifying : apr-1.4.8-3.el7.x86_64 3/6
Verifying : mailcap-2.1.41-2.el7.noarch 4/6
Verifying : apr-util-1.5.2-6.el7.x86_64 5/6
Verifying : centos-logos-70.0.6-3.el7.centos.noarch 6/6
Installed:
httpd.x86_64 0:2.4.6-40.el7.centos
Dependency Installed:
apr.x86_64 0:1.4.8-3.el7
apr-util.x86_64 0:1.5.2-6.el7
centos-logos.noarch 0:70.0.6-3.el7.centos
httpd-tools.x86_64 0:2.4.6-40.el7.centos
mailcap.noarch 0:2.1.41-2.el7
Complete!
[root@clusterserver3 /]#
[root@clusterserver3 ~]# docker ps -a | head -2
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0ea3378b8999 centos “/bin/bash -c ‘yum -y” 9 seconds ago Up 9 seconds reverent_bose
[root@clusterserver3 ~]# docker commit 0ea3378b8999 my_image/centos_httpd
bc71655dc09687f4e7a78372d86fd46b110c3147d58e5bb1b77db0355cf6ad56
[root@clusterserver3 ~]#
[root@clusterserver3 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
my_image/centos_httpd latest bc71655dc096 37 seconds ago 250 MB
docker.io/centos latest 60e65a8e4030 8 days ago 196.6 MB
[root@clusterserver3 ~]#
Recent Comments