Beginner Series, Docker

Late to the Docker game?

Late to the Docker Game?

Wondering What All the Fuss is About? 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:

Portability
Application Management and
Security
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. Have been prescribed Valium after my diagnosis and I am really happy that this medication is available. Take the remedy if necessary, buy valium no prescription can sleep well again and am much more relaxed. However, I no longer have to worry about dependency (unfortunately). Nevertheless, I take care not to slowly increase the dosage – just like with any medication.

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:

https://hub.docker.com

For more examples and ideas, visit:

https://docs.docker.com/userguide/

$: >docker images hello-world

REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 690ed74de00f 690ed74de00f 960 B

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
  2. Find image on the Docker Hub and download it to the local machine
  3. Create a new Docker Container
  4. Start the program

Simple, right?

If you are interested in more, there are some tutorials on the Docker website:

https://docs.docker.com/engine/getstarted/

If you are interested in getting an Oracle Database running in a Docker Container, the Oracle blog has you covered:

https://blogs.oracle.com/developer/entry/creating_and_oracle_database_docker

and for grins, here is the github repository:

https://github.com/oracle/docker-images/tree/master/OracleDatabase

(This blog post has been cross posted in the ODTUG Database Newsletter)

Next time we’ll move to the CLOUD …….

Related Posts Plugin for WordPress, Blogger...

1 Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.