Please also refer here
We are going to install Docker from EPEL repository.
Check if the EPEL repository is there :
# rpm -qa | grep epel
epel-release-6-8.noarch
I do have epel on my server. If not, you need to install it.
Now continue to install docker-io
$ sudo yum install docker-io
[sudo] password for lo:
Loaded plugins: fastestmirror, priorities, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirror.cs.vt.edu
* epel: epel.mirror.constant.com
* extras: mirror.anl.gov
* updates: mirrors-pa.sioru.com
222 packages excluded due to repository priority protections
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package docker-io.x86_64 0:1.0.0-3.el6 will be installed
--> Processing Dependency: lxc for package: docker-io-1.0.0-3.el6.x86_64
--> Running transaction check
---> Package lxc.x86_64 0:0.9.0-2.el6 will be installed
--> Processing Dependency: liblxc.so.0()(64bit) for package: lxc-0.9.0-2.el6.x86_64
--> Running transaction check
---> Package lxc-libs.x86_64 0:0.9.0-2.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================
Package Arch Version Repository Size
====================================================================================================================
Installing:
docker-io x86_64 1.0.0-3.el6 epel 4.5 M
Installing for dependencies:
lxc x86_64 0.9.0-2.el6 epel 78 k
lxc-libs x86_64 0.9.0-2.el6 epel 116 k
Transaction Summary
====================================================================================================================
Install 3 Package(s)
Total download size: 4.7 M
Installed size: 24 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): docker-io-1.0.0-3.el6.x86_64.rpm | 4.5 MB 00:03
(2/3): lxc-0.9.0-2.el6.x86_64.rpm | 78 kB 00:00
(3/3): lxc-libs-0.9.0-2.el6.x86_64.rpm | 116 kB 00:00
--------------------------------------------------------------------------------------------------------------------
Total 1.4 MB/s | 4.7 MB 00:03
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : lxc-libs-0.9.0-2.el6.x86_64 1/3
Installing : lxc-0.9.0-2.el6.x86_64 2/3
Installing : docker-io-1.0.0-3.el6.x86_64 3/3
Verifying : docker-io-1.0.0-3.el6.x86_64 1/3
Verifying : lxc-libs-0.9.0-2.el6.x86_64 2/3
Verifying : lxc-0.9.0-2.el6.x86_64 3/3
Installed:
docker-io.x86_64 0:1.0.0-3.el6
Dependency Installed:
lxc.x86_64 0:0.9.0-2.el6 lxc-libs.x86_64 0:0.9.0-2.el6
Complete!
Now it is install. We need to start the Docker daemon.
$ sudo service docker start
Starting docker: [ OK ]
If we want Docker to start at boot, we need to run this :
$ sudo chkconfig docker on
Now we try test Docker and get the CentOS image
$ sudo docker pull centos:latest
Pulling repository centos
0c752394b855: Download complete
511136ea3c5a: Download complete
34e94e67e63a: Download complete
We make sure we can see the image :
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos latest 0c752394b855 3 weeks ago 124.1 MB
Now try run bash using this centos image
$ sudo docker run -i -t centos /bin/bash
bash-4.1# ps
PID TTY TIME CMD
1 ? 00:00:00 bash
6 ? 00:00:00 ps
bash-4.1# df
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 10321208 300108 9496812 4% /
/dev/mapper/docker-253:0-1179712-6d24d5cf87a18d748db4bc41f1d591f1fa10aebb0e8f3503be0270d9a557d009
10321208 300108 9496812 4% /
tmpfs 3984768 0 3984768 0% /dev
shm 65536 0 65536 0% /dev/shm
/dev/mapper/vg_novo-lv_root
407481848 84566084 302216836 22% /.dockerinit
/dev/mapper/vg_novo-lv_root
407481848 84566084 302216836 22% /etc/resolv.conf
/dev/mapper/vg_novo-lv_root
407481848 84566084 302216836 22% /etc/hostname
/dev/mapper/vg_novo-lv_root
407481848 84566084 302216836 22% /etc/hosts
tmpfs 3984768 0 3984768 0% /proc/kcore
bash-4.1# pwd
/
bash-4.1# ls
bin dev etc home lib lib64 lost+found media mnt opt proc root sbin selinux srv sys tmp usr var
Outside of this docker container, we can check what is running :
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6d24d5cf87a1 centos:latest /bin/bash 3 minutes ago Up 3 minutes ecstatic_pare
No comments:
Post a Comment