Setting up Docker

As Docker relies on Linux specific virtualization features like cgroups and namespaces, the tool is only available for Linux. Through clever use of Oracle Virtualbox and a very minimal customised Tiny Core Linux installation in the tool Boot2Docker, the software also is available for Windows (7+) and Mac (OS X 10.6+)

Docker has very comprehensible documentation about installing Docker on a variety of platforms, but here we will run you through the installation on Oracle Enterprise Linux 7.1 (OEL7.1)

For the remainder of this series we will use OEL7.1 as the host OS. In the next steps we will get it ready for our Docker images. We are running a VirtualBox virtual machine with OEL7.1 Server on a Windows 7 machine, which works just as well. Our machine has an Intel i7 processor from the Sandy Bridge range, 16GB RAM and 500GB HDD.
Make sure your OS has sufficient space on its hard disk, and also enough RAM. You’ll need at least 40GB of free space and 8GB of RAM.

How to read this blog

In this series, we’ll display prompts as follows:

host#      - a command you type on the host system (as root)
container# - a command you type inside the container (as root)
container$ - a command you type inside the container (as oracle)

Installing Docker

For Oracle Linux customers with an active support subscription: Docker is available in the ol7_x86_64_addons channel for Oracle Linux 7 on the Unbreakable Linux Network (ULN). For Oracle Linux users without an active support subscription: Docker is available in the ol7_addons repository on Oracle Public Yum.

As we don’t have an active subscription, we need to use the public repository.

Enable addons repository on Oracle Public Yum

Edit /etc/yum.repos.d/public-yum-ol7.repo and set enabled=1 in the [ol7_addons] stanza.

Disabling SELinux

SElinux must be set to Disabled or Permissive in /etc/sysconfig/selinux to use the (default) btrfs storage engine on Oracle Linux 7. You might run into some unexpected issues when SELinux is not disabled!

Install software

Switch to the root user (su -) and install Docker with the following command:

host# yum install docker

After successful completion of this command, we have installed Docker!

Modify installation for big images

The default Docker installation only accommodates for images with a maximum size of 10GB. As installing software by a certain vendor with a red logo will take a lot of space, we’ll have to modify a parameter in Docker to get it set up right.

Edit the file /etc/sysconfig/docker, and set the OPTIONS entry to have --storage-opt dm.basesize=20G.

Starting Docker

Starting docker is easy: just kick off the following command to start the Docker Daemon:

host# systemctl start docker.service

And if you want to start Docker automatically after a reboot:

host# systemctl enable docker.service

All done! Now we can start using Docker to do some useful stuff.

This post is part of a series on virtualization with Docker.

  1. What is Docker?
  2. Setting up Docker
  3. Creating an Oracle SOA Suite 12c Docker image
  4. Resizing the disk on a VirtualBox OEL7 image
  5. Jenkins: Setting up a Shared Library for your pipelines
  6. Jenkins: Using Gradle to build your Shared Library
  7. Jenkins: Creating a custom pipeline step in your library
  8. Jenkins: Running a declarative pipeline from your Shared Library