What is Docker? To answer this question, let’s talk about what Docker is not. While you can write scripts to interact with Docker, it is not a programming language. The natural response when working with Docker containers is to attempt to frame it in the context of a virtual machine. While they display similar characteristics, such as providing an environment in which to run an application and you can move VMs and Docker Containers between host machines, Docker Containers are not the same as VMs. Think of a virtual machine as a house: fully self-contained with all resources such as electricity, water, gas, etc. dedicated to servicing the house. Docker containers are more like hotel rooms. Common infrastructure servicing the building with each room/container with specific configuration.
To dive a little deeper, Docker, simply put, is a background daemon and a set of services that allow for the isolation of an environment for running software using a UNIX technology known as containers. In the Docker context, we now have a solution to get around the difficulty of building containers directly. Docker gives us a layer of abstraction providing a consistent container build and simplifying both management and application deployments by breaking them down into smaller components, isolating them, and managing the interaction between the services.
Prior to this, we were accustomed to spinning up the traditional virtual machine using VirtualBox, VMWare, or OVM. These tools provided isolation in almost the opposite direction of containers. We start with a full OS install and then install our applications on top. We can run multiple VMs with this model installing the OS and various applications in individual VMs. This approach is resource intensive as we are running multiple copies of an OS on the host machine. Docker’s approach doesn’t use this hardware virtualization concept. Programs running in Docker containers work directly with the host operating system. We can consider this an OS virtualization vs the hardware virtualization method of VMs.
There are several other aspects of Docker that make it attractive such as:
- Application Management and
but we can save those topics for another time.
Now that you have an idea of what Docker is, let’s walk through the proverbial “Hello, World!” example. The quickest way to get going is to visit http:/www.docker.com and download and install the Community Edition. There are distributions for the major operating systems. (Please note that if you plan on using Docker on a Windows machine, there are compatibility issues with VirtualBox running on the same box as Docker enables Hyper-V on Windows which prevents applications such as VirtualBox and VMWare Workstation or Player from running.)
Once you have Docker installed, simply go to your command prompt and enter the following.
$: > docker run hello-world
If you have installed Docker successfully, you will be presented with the message below.
Hello from Docker.
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
- The Docker client contacted the Docker daemon.
- The Docker daemon pulled the "hello-world" image from the Docker Hub.
- The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading
- 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:
For more examples and ideas, visit:
$: >docker images hello-world
So, what really just happened here? Let’s break down this process step by step:
Let’s assume that the image is not on the local machine
1. Docker looks to see if the image, in the case “hello-world” is on the computer.
a. If not, go to the Docker Hub and look for it
b. If it is, then run the image in the Docker Container <done>
2. Find image on the Docker Hub and download it to the local machine
3. Create a new Docker Container
4. Start the program
If you are interested in more, there are some tutorials on the Docker website:
If you are interested in getting an Oracle Database running in a Docker Container, the Oracle blog has you covered:
and for grins, here is the github repository: