Installing Docker on Oracle Enterprise Linux 6

Recently I found out about Docker. If your really want to learn more, their website is absolutely a good place to start. Especially their learn more section should get you started. As quoted from their website Docker is an open-source engine that automates the deployment of any application as a lightweight, portable, self-sufficient container that will run virtually anywhere. In this post we’re going to install Docker on the Oracle Enterprise Linux 6.5 (64 bit) release. Docker is not available in the standard installation of OEL, so we need to add the EPEL (Extra Packages for Enterprise Linux) repository to our installation.

Oracle Enterprise Linux can be downloaded from Oracle’s Edelivery. To get access you need to create an account. It’s also possible to use CentOS instead. Make sure you download the latest version (currently 6.5) and that it’s the 64-bit version.

Since I’m a big fan of VirtualBox, I did the installation of OEL on a virtual Machine. The Virtual Machine has the following specs:
– 8192 MB memory
– 1 CPU
– 1 disk of 50 GB
– 2 network interfaces. One is bridged and the other one is a host only connection. Since we’re gone need a connection to the internet a bridged one is the easiest way.
To get an idea, this is the kickstart file I’ve used (I know I could have had less packages, but this was the easiest installation):

# Kickstart file automatically generated by anaconda.

lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
network --onboot yes --device eth1 --bootproto dhcp --noipv6
rootpw --iscrypted $6$PnDixdlCEvurQEVC$tQlue4VPnu24zCwjMgqW8eQxfnDnxTOeFnCfmeEYyKU4EqBdyLmpY4s2ibcG/jRKveaWBKwgkPgfY42w/rMsA.
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone Europe/Amsterdam
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --linux --drives=sda

part /boot --fstype=ext4 --size=500
part pv.008002 --grow --size=1

volgroup vg_system --pesize=4096 pv.008002
logvol / --fstype=ext4 --name=lv_root --vgname=vg_system --size=45576
logvol swap --name=lv_swap --vgname=vg_system --size=5120


1. After an installation of OEL it’s always a good idea to update to the latest version. As a default the Oracle public repository is already available (as long as your system is connected to the internet). Run a yum update to make sure the all packages have the latest version installed:

[root@oel6-docker ~]# yum update –y

Depending on the number of updates this can take some time (I had an update of 66 packages and 4 extra packages were installed). After the updates are installed it’s always a good idea to reboot your system (Most of the time an update of the kernel is installed).
[root@oel6-docker ~]# reboot

2. To install the Docker package we need access to the EPEL repository. To install the repository files download the EPEL RPM:
[root@oel6-docker ~]# wget
--2014-05-03 13:53:34--
Resolving,,, ...
Connecting to||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14540 (14K) [application/x-rpm] Saving to: “epel-release-6-8.noarch.rpm”

100%[==========================================================================================>] 14,540 --.-K/s in 0.1s

2014-05-03 13:53:34 (96.9 KB/s) - “epel-release-6-8.noarch.rpm” saved [14540/14540] [root@oel6-docker ~]#

Next thing to do is to install this RPM:
[root@oel6-docker ~]# yum localinstall -y epel-release-6-8.noarch.rpm
Loaded plugins: security
Setting up Local Package Process
Examining epel-release-6-8.noarch.rpm: epel-release-6-8.noarch
Marking epel-release-6-8.noarch.rpm to be installed
public_ol6_UEKR3_latest | 1.2 kB 00:00
public_ol6_latest | 1.4 kB 00:00
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:6-8 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

Package Arch Version Repository Size
epel-release noarch 6-8 /epel-release-6-8.noarch 22 k

Transaction Summary
Install 1 Package(s)

Total size: 22 k
Installed size: 22 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : epel-release-6-8.noarch 1/1
Verifying : epel-release-6-8.noarch 1/1

epel-release.noarch 0:6-8


3. Now we can actually install the Docker package with the yum command:
[root@oel6-docker ~]# yum install -y docker-io

This will also install some packages that are required for Docker. In my case 30 extra packages were installed:

docker-io.x86_64 0:0.9.0-3.el6

Dependency Installed:
augeas-libs.x86_64 0:1.0.0-5.el6_5.1 compat-db43.x86_64 0:4.3.29-15.el6
cyrus-sasl-md5.x86_64 0:2.1.23-13.el6_3.1 dnsmasq.x86_64 0:2.48-13.el6
ebtables.x86_64 0:2.0.9-6.el6 glusterfs-api.x86_64 0:
glusterfs-libs.x86_64 0: gnutls-utils.x86_64 0:2.8.5-13.el6_5
iscsi-initiator-utils.x86_64 0: keyutils.x86_64 0:1.4-4.el6
libcgroup.x86_64 0:0.40.rc1-5.el6_5.1 libevent.x86_64 0:1.4.13-4.el6
libgssglue.x86_64 0:0.1-11.el6 libtirpc.x86_64 0:0.2.1-6.el6_5.1
libvirt.x86_64 0:0.10.2-29.0.1.el6_5.7 libvirt-client.x86_64 0:0.10.2-29.0.1.el6_5.7
libxslt.x86_64 0:1.1.26-2.0.2.el6_3.1 lxc.x86_64 0:0.9.0-2.0.5.el6
lxc-libs.x86_64 0:0.9.0-2.0.5.el6 lzop.x86_64 0:1.02-0.9.rc1.el6
nc.x86_64 0:1.84-22.el6 netcf-libs.x86_64 0:0.1.9-4.el6_5.2
nfs-utils.x86_64 1:1.2.3-39.el6 nfs-utils-lib.x86_64 0:1.1.5-6.el6
numad.x86_64 0:0.5-9.20130814git.el6 qemu-img.x86_64 2:
radvd.x86_64 0:1.6-1.el6 rpcbind.x86_64 0:0.2.0-11.el6
usbredir.x86_64 0:0.5.1-1.el6 yajl.x86_64 0:1.0.7-3.el6

If you want to try the latest version of docker, than you can upgrade to the one that’s in the EPEL testing repository:
[root@oel6-docker ~]# yum update --enablerepo=epel-testing -y docker-io

4. Make sure that docker always starts at boottime and start the daemon:
[root@oel6-docker ~]# chkconfig docker on[root@oel6-docker ~]# service docker start
Starting cgconfig service: [ OK ] Starting docker: [ OK ]

By the way: This is a good time to make a snapshot of your VirtualBox Virtual Machine, just in case.

5. Currently we have no images we can run, which van be seen with the docker images command:
[root@oel6-docker ~]# docker images

To search for images from the docker index site you can use the docker search command:
[root@oel6-docker ~]# docker search ubuntu
ubuntu Official Ubuntu base image 0
stackbrew/ubuntu Barebone ubuntu images 0
dockerfile/ubuntu Trusted Ubuntu ( Build 0
tutum/ubuntu DEPRECATED. Use tutum/ubuntu-saucy instead... 0
cmfatih/ubuntu Ubuntu [ ubuntu , vim , htop , zip , wget ... 0
tutum/ubuntu-quantal Ubuntu Quantal image with SSH access. For ... 0
libmesos/ubuntu 0
tutum/ubuntu-precise Ubuntu Precise image with SSH access. For ... 0
jahkeup/ubuntu Ubuntu 13.10 base release 0
crohr/ubuntu Ubuntu base images. Only lucid (10.04) for... 0
flox/ubuntu-openerp Run OpenERP on Ubuntu - April 2014 0
totem/ubuntu A minimal base install of Ubuntu for use i... 0
vyom/ubuntu Ubuntu 14.04 LTS Trusty Base Image for doc... 0
markshao/ubuntu 0
newsdev/ubuntu 0
tianon/ubuntu-core Ubuntu Core ( 0
angelrr7702/ubuntu-13.10-sshd sshd base on angelrr7702/ubuntu-13.10 0
dpaw/ubuntu Ubuntu with AU mirror and universe repo en... 0
amosrivera/ubuntu Ubuntu 13.10 with NodeJS, Nginx, Ruby and ... 0
ubuntu-upstart 0
tutum/ubuntu-saucy Ubuntu Saucy image with SSH access. For th... 0
calebcase/ubuntu Basic Ubuntu Raring image. 0
pandrew/ubuntu-lts 0
angelrr7702/ubuntu-13.10 ubuntu 13.10 base to be use for building ... 0
jdharrington/ubuntu The official Docker Ubuntu image with buil... 0

Lets download (pull) the one that says Official Ubuntu base image. But we only want to download the latest version so add that to your pull request:
[root@oel6-docker ~]# docker pull ubuntu:latest
Pulling repository ubuntu
99ec81b80c55: Download complete
511136ea3c5a: Download complete
5e66087f3ffe: Download complete
4d26dd3ebc1c: Download complete
d4010efcfd86: Download complete

Now when we look again with the commando docker images, we have one image available:
[root@oel6-docker ~]# docker images
ubuntu latest 99ec81b80c55 8 days ago 266 MB

6. With this image we can start a container. Use the docker run command for that:
[root@oel6-docker ~]# docker run -i -t ubuntu /bin/bash

We used the run command with the following options:

-i Keep stdin open even if not attached
-t Allocate a pseudo-tty

This command will start the bash shell inside the container where we can run regular linux commands:

root@9109bc74f842:/# ps -ef
root 1 0 0 13:00 ? 00:00:00 /bin/bash
root 8 1 0 13:00 ? 00:00:00 ps –ef

With another terminal to our virtual machine we can see the containers currently running with the docker ps command:
[root@oel6-docker ~]# docker ps
7ddf91c2c9ca ubuntu:latest /bin/bash 3 seconds ago Up 2 seconds jolly_curie

If you add the -a option, you see all the containers that were started.
[root@oel6-docker ~]# docker ps -a
7ddf91c2c9ca ubuntu:latest /bin/bash 27 seconds ago Up 26 seconds jolly_curie
2154f5ad48f2 ubuntu:latest /bin/bash 34 seconds ago Exited (0) 32 seconds ago boring_lumiere
fbdf81e7f130 ubuntu:latest /bin/bash 5 minutes ago Exited (0) 5 minutes ago drunk_mestorf
9109bc74f842 ubuntu:latest /bin/bash 7 minutes ago Exited (0) 5 minutes ago romantic_hopper
ecf0f7637cf7 ubuntu:latest /bin/bash 9 minutes ago Exited (0) 9 minutes ago hungry_lalande

7. To exit out of the container environment just type the command exit:

root@7ddf91c2c9ca:/# exit

In this case the container stops, but can be started again with the docker start <CONTAINER_ID> command:
[root@oel6-docker ~]# docker ps -a
7ddf91c2c9ca ubuntu:latest /bin/bash 26 minutes ago Exited (0) 39 seconds ago jolly_curie[root@oel6-docker ~]# docker start 7ddf91c2c9ca

To attach again to the console of the container, use the docker attach <CONTAINER_ID> command:
[root@oel6-docker ~]# docker attach 7ddf91c2c9ca

It’s also possible to start multiple containers of the same image. This is one of the basics of Docker so you can deploy new applications really fast.
These are some basic commands for Docker. In the next posts I’ll describe how to create your own Oracle Enterprise Linux 6 base image, which can be used as a base to install other software on. I will also describe how to add the Oracle XE database to an image.

7 mei 2014|Docker, Linux|

Leave A Comment