Docker installation on Oracle Linux 7.2

Oracle Linux 7.2 Installation

To get ready for this Blog I performed a standard Linux 7.2 installation, during the ‘Software Selection’ part of the wizard selected ‘Base Environent’ of ‘Server with GUI’ and the following ‘Add-Ons for Selected Evironment’

  • Compatibility Libraries
  • Development Tools

If you need further install details, I have a seperate Blog posting on performing an Oracle Linux 7.2 installation.

Kernel Upgrade

The Oracle Linux R7 Update 2 ships with a 3.8.13 Kernel however Docker requires a Kernel of 4.1.12 or higher on Oracle Linux, this kernel supports the Docker btrfs storage engine on both Oracle Linux 6 and 7.

Oracle Linux Docker Prerequisites

With yum this is easliy fixed,  by telling yum to use the release 4 Kernel repository.

[root@oel7 ~]# uname -r
3.8.13-98.7.1.el7uek.x86_64

[root@oel7 ~]# yum list kernel-uek*
Loaded plugins: langpacks, ulninfo
Installed Packages
kernel-uek.x86_64                            3.8.13-98.7.1.el7uek        @anaconda/7.2
kernel-uek-devel.x86_64                3.8.13-98.7.1.el7uek       @anaconda/7.2
kernel-uek-firmware.noarch         3.8.13-98.7.1.el7uek       @anaconda/7.2
Available Packages
kernel-uek.x86_64                             3.8.13-118.10.2.el7uek   ol7_UEKR3
kernel-uek-debug.x86_64               3.8.13-118.10.2.el7uek   ol7_UEKR3
kernel-uek-debug-devel.x86_64  3.8.13-118.10.2.el7uek   ol7_UEKR3
kernel-uek-devel.x86_64                3.8.13-118.10.2.el7uek   ol7_UEKR3
kernel-uek-doc.noarch                     3.8.13-118.10.2.el7uek   ol7_UEKR3
kernel-uek-firmware.noarch          3.8.13-118.10.2.el7uek   ol7_UEKR3

OK, lets tell yum to use our new repository

[root@oel7 ~]# vi /etc/yum.repos.d/public-yum-ol7.repo

[ol7_UEKR3]
name=Latest Unbreakable Enterprise Kernel Release 3 for Oracle Linux $releasever ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL7/UEKR3/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_UEKR4]
name=Latest Unbreakable Enterprise Kernel Release 4 for Oracle Linux $releasever ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL7/UEKR4/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[ol7_addons]
name=Oracle Linux $releasever Add ons ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

As you can see from above I have disabled ol7_UEKR3, enabled the ol7_addons and added a new section form ol7_UEKR4, we can now use yum to pick up the new 4.1.12 Kernel.

[root@oel7 ~]# yum list kernel-uek*
Loaded plugins: langpacks, ulninfo
Installed Packages
kernel-uek.x86_64                             3.8.13-98.7.1.el7uek  @anaconda/7.2
kernel-uek-devel.x86_64                3.8.13-98.7.1.el7uek  @anaconda/7.2
kernel-uek-firmware.noarch         3.8.13-98.7.1.el7uek  @anaconda/7.2
Available Packages
kernel-uek.x86_64                             4.1.12-37.6.3.el7uek  ol7_UEKR4
kernel-uek-debug.x86_64               4.1.12-37.6.3.el7uek  ol7_UEKR4
kernel-uek-debug-devel.x86_64  4.1.12-37.6.3.el7uek  ol7_UEKR4
kernel-uek-devel.x86_64                4.1.12-37.6.3.el7uek  ol7_UEKR4
kernel-uek-doc.noarch                    4.1.12-37.6.3.el7uek  ol7_UEKR4
kernel-uek-firmware.noarch         4.1.12-37.6.3.el7uek  ol7_UEKR4

Ok lets let yum do it’s thing.
[root@oel7 ~]# yum update

Time for a coffee…

SELinux support on Oracle Linux 7

Docker requires SElinux to be set to Permissive or Disabled in /etc/sysconfig/selinux to use the btrfs storage engine on Oracle Linux 7, so lets change it now if not already set before we reboot.

[root@oel7 ~]# vi /etc/sysconfig/selinux

SELINUX=permissive

[root@oel7 ~]# setenforce Permissive

Reboot to pick up the new 4.1.12 Kernel

[root@oel7 ~]# uname -r
4.1.12-37.6.3.el7uek.x86_64

Docker 1.10

As we have updated the yum repository to use ol7_addons we can now install the docker engine.

[root@oel7 ~]# yum list docker-engine
Loaded plugins: langpacks, ulninfo
Available Packages
docker-engine.x86_64             1.10.3-1.0.3.el7   ol7_addons

[root@oel7 ~]# yum install docker-engine
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
–> Running transaction check
—> Package docker-engine.x86_64 0:1.10.3-1.0.3.el7 will be installed
–> Processing Dependency: docker-engine-selinux >= %{epoch}:1.10.3-1.0.3.el7 for package: docker-engine-1.10.3-1.0.3.el7.x86_64
–> Running transaction check
—> Package docker-engine-selinux.noarch 0:1.10.3-1.0.3.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================
Package Arch Version Repository Size
================================================================================================================================================
Installing:
docker-engine x86_64 1.10.3-1.0.3.el7 ol7_addons 9.6 M
Installing for dependencies:
docker-engine-selinux noarch 1.10.3-1.0.3.el7 ol7_addons 28 k

Transaction Summary
================================================================================================================================================
Install 1 Package (+1 Dependent package)

Total download size: 9.6 M
Installed size: 41 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): docker-engine-selinux-1.10.3-1.0.3.el7.noarch.rpm | 28 kB 00:00:05
(2/2): docker-engine-1.10.3-1.0.3.el7.x86_64.rpm | 9.6 MB 00:00:13
————————————————————————————————————————————————
Total 710 kB/s | 9.6 MB 00:00:13
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : docker-engine-selinux-1.10.3-1.0.3.el7.noarch 1/2
Installing : docker-engine-1.10.3-1.0.3.el7.x86_64 2/2
Verifying : docker-engine-1.10.3-1.0.3.el7.x86_64 1/2
Verifying : docker-engine-selinux-1.10.3-1.0.3.el7.noarch 2/2

Installed:
docker-engine.x86_64 0:1.10.3-1.0.3.el7

Dependency Installed:
docker-engine-selinux.noarch 0:1.10.3-1.0.3.el7

Complete!

[root@oel7 ~]# docker –version
Docker version 1.10.3, build 57bf6fd

Docker Installation Check

First let’s start the service

[root@oel7 ~]# systemctl start docker.service

Now we can check the docker with the ‘Hello World’ container.
[root@oel7 ~]# docker run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
c04b14da8d14: Pull complete
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the “hello-world” image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
https://hub.docker.com

For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/

Docker 1.12

If you want to use a slighty new version of docker you can go directly to the docker projects own yum repository, the Docker install check step is the same.

[root@oel7 ~]# cd /etc/yum.repos.d/
[root@oel7 yum.repos.d]# vi docker.repo
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/oraclelinux/7
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg

[root@oel7 yum.repos.d]# yum list docker-engine
Loaded plugins: langpacks, ulninfo
Available Packages
docker-engine.x86_64             1.12.0-1.el7       dockerrepo

[root@oel7 ~]# yum install docker-engine
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
–> Running transaction check
—> Package docker-engine.x86_64 0:1.12.0-1.el7 will be installed
–> Processing Dependency: docker-engine-selinux >= 1.12.0-1.el7 for package: docker-engine-1.12.0-1.el7.x86_64
–> Running transaction check
—> Package docker-engine-selinux.noarch 0:1.12.0-1.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================
Installing:
docker-engine x86_64 1.12.0-1.el7 dockerrepo 19 M
Installing for dependencies:
docker-engine-selinux noarch 1.12.0-1.el7 dockerrepo 28 k

Transaction Summary
=============================================================================================================================================================================
Install 1 Package (+1 Dependent package)

Total download size: 19 M
Installed size: 79 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7Server/dockerrepo/packages/docker-engine-selinux-1.12.0-1.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY00:00:34 ETA
Public key for docker-engine-selinux-1.12.0-1.el7.noarch.rpm is not installed
(1/2): docker-engine-selinux-1.12.0-1.el7.noarch.rpm | 28 kB 00:00:06
(2/2): docker-engine-1.12.0-1.el7.x86_64.rpm | 19 MB 00:00:22
—————————————————————————————————————————————————————————–
Total 851 kB/s | 19 MB 00:00:22
Retrieving key from https://yum.dockerproject.org/gpg
Importing GPG key 0x2C52609D:
Userid : “Docker Release Tool (releasedocker) <docker@docker.com>”
Fingerprint: 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d
From : https://yum.dockerproject.org/gpg
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : docker-engine-selinux-1.12.0-1.el7.noarch 1/2
restorecon: lstat(/var/lib/docker) failed: No such file or directory
warning: %post(docker-engine-selinux-1.12.0-1.el7.noarch) scriptlet failed, exit status 255
Non-fatal POSTIN scriptlet failure in rpm package docker-engine-selinux-1.12.0-1.el7.noarch
Installing : docker-engine-1.12.0-1.el7.x86_64 2/2
Verifying : docker-engine-selinux-1.12.0-1.el7.noarch 1/2
Verifying : docker-engine-1.12.0-1.el7.x86_64 2/2

Installed:
docker-engine.x86_64 0:1.12.0-1.el7

Dependency Installed:
docker-engine-selinux.noarch 0:1.12.0-1.el7

Complete!

[root@oel7 ~]# docker –version
Docker version 1.12.0, build 8eab29e

Advertisements

One thought on “Docker installation on Oracle Linux 7.2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s