Tuesday, January 17, 2017

Running Oracle in a Docker Container - Part 1

In this post, I'll be showing how to download Docker, then a container image, and start up a container and connect to it.

Subsequent posts will show how to create a Docker repository in the cloud, run Oracle 11g XE in a container, connect to it with SQL Developer, run an Ubuntu desktop, and run Oracle APEX inside a container among other pretty interesting things.

Goodbye Virtualbox, hello Docker?

Well, maybe not quite.

I’ve heard a bit about Docker, it seems this is the ‘in’ thing – it’s so trendy it has a beard and tattoos.

It’s mainly aimed at Development - it’s a container system that allows you to spin up an OS and install the stuff to create an environment that is always the same, and you can version it.

Docker v VMs:


Virtual machines include the application, the necessary binaries and libraries, and an entire guest operating system, all of which can amount to tens of GBs.


Containers include the application and all of its dependencies, but share the kernel with other containers, running as isolated processes in user space on the host operating system.
Docker containers are not tied to any specific infrastructure: they run on any computer, on any infrastructure, and in any cloud.

At first I thought I could use this to replace some Windows VMs, but (at the moment at least) you can’t run a Windows desktop. However, you can fire up an Ubuntu desktop and connect to it using VNC.

You will need to download and install Docker, and also create a repository in their cloud (not essential but worth it, it's free).

For Windows V10 and Server 2016, and Apple Mac OS, the app is hooked into the OS.

For earlier versions of Windows, pre 10 and 2016, the Docker app is stand-alone.

Older (less than V10) versions of Windows

Once downloaded, install and run:


This will start a terminal  window - type 'docker images' on the command line:

It will be empty. The commands in the section below on Apple Mac are the same for this version, so just follow those instructions.

Note that when you install it onto Windows 10, it disables VirtualBox – they can’t run together for some reason.

Apple Mac OS

Once downloaded, the Docker icon will be in the toolbar and will start


You can then open a terminal and run Docker commands directly:


The following commands are run in docker, whether it's a Mac, Linux or Windows box.
If you've just installed it, you will not have any containers (images):


Docker has a public repository of images. Just use the pull command to download and install:
docker pull ubuntu
docker pull centos


You now have a Centos linux machine ready to use.

To use it, run this command:

docker run -t -i centos /bin/bash

So this is telling docker to start the container and run /bin/bash, which gives the unix prompt.

This is the reference for the 'run' command : https://docs.docker.com/engine/reference/run/


 So that's the end of the first part - you now have a Linux container.

Note that any changes you make will be lost - the next post describes how to commit the changes as well as creating a repository in the Docker cloud to store your containers so anyone can get them.