Showing results for 
Search instead for 
Did you mean: 

Docker Setup Quickstart

EDB Team Member


Provide some tips/tricks to setup Docker on whatever platform you are using, and provide a couple simple test cases to prove that you are ready to move to more complex Docker examples.



Have a Mac, Windows, or Linux machine preferably with a recent version of the operating system



What is Docker? It is a tool for packaging and running applications on any platform. Some like to think of Docker as a way to provide much lighter-weight virtualization options than most other virtualization products. Some like to think of Docker as a way to package applications as Docker images where that same image can run unchanged on Windows, Mac, Linux, or any other platform that supports Docker. At a very technical level, those are probably not correct. But at a logical level, I think they help to show the value well.


A full overview of Docker is beyond the scope of this guide. Please refer to these links to learn it better:


At a basic level, you are going to create an environment where you can run commands like "docker images" to list the images in your environment (sort of like a VMDK or AMI), "docker ps" to list the containers (images that are running, sort of like VMs). Docker requires a Linux kernel. If the computer you are using for this is not Linux, don't panic, Docker has ways of installing super light-weight VMs on your Mac or Windows machine that will be managed for you so that you don't even need to know that a light weight Linux VM is actually running and serving as the host for your Docker environment. 


Components to Install

There is one primary component, and a second that I recommend so that your Docker containers can export displays (ie run GUIs) back to your main computer display. Running a GUI in a docker container is probably not the best case for Docker, but I tend to do it more often than I expect.

  1. Install Docker
  2. Install an X Server (if you are not on Linux)
    • Mac Users:  XQuarts:
      • Edit /usr/X11/bin/startx to ensure that your X Server will listed on TCP 6000 so that container can export their display to it by following the instructions below (future versions of XQuarts may already have this set correctly).
      • Look for this:

        if [ x`defaults read $X11_PREFS_DOMAIN nolisten_tcp` = x1 ] ; then
            defaultserverargs="$defaultserverargs -nolisten tcp"
      • Make it this:

        if [ x`defaults read $X11_PREFS_DOMAIN nolisten_tcp` = x1 ] ; then
            defaultserverargs="$defaultserverargs -nolisten tcp"
            defaultserverargs="$defaultserverargs -listen tcp"
    • Windows Users:  XMing:
Steps to Check Your Setup
1)  See if you can run Docker to list running Docker containers:  "docker ps", should look like this:
#> docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
2)  See if you can list your Docker images (should not be any):
#> docker images
REPOSITORY          TAG                           IMAGE ID            CREATED             SIZE

3)  See if you can pull down the latest CentOS image:

#> docker pull centos
Using default tag: latest
latest: Pulling from library/centos
8d30e94188e7: Pull complete 
Digest: sha256:2ae0d2c881c7123870114fb9cc7afabd1e31f9888dac8286884f6cf59373ed9b
Status: Downloaded newer image for centos:latest


4)  Now list your images
#> docker images
REPOSITORY          TAG                           IMAGE ID            CREATED             SIZE
centos              latest                        980e0e4c79ec        7 days ago          196.8 MB


5)  Now, let's run the CentOS image in a container that prints the CentOS version and then exits.  This is effectively starting a CentOS container, cat'ing the CentOS version, then stoping and removing the container.  A lot happens in the second or two that this runs.
#> docker run -rm -it centos:latest cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core) 


6)  Now, let's get a little fancier.  We are going to run a container and get inside of it by running bash as our command when starting the container.  This is sort of like starting a VM and then SSH'ing into it - sort of.  While we are in there, we will install xclock and try to launch it and have the display echo back to our main computer.  Keep in mind that you must have XQuartz or Xming running, and you must know the IP address of your host machine.
#> xhost +
access control disabled, clients can connect from any host
#> docker run --rm -it centos /bin/bash
[root@8200ec758a6e /]# yum install -y xclock
Loaded plugins: fastestmirror, ovl
base                                                                                                              | 3.6 kB  00:00:00     
[... skipping all the install logs ...]
[root@8200ec758a6e /]# export DISPLAY=<YOUR IP ADDRESS>:0
[root@8200ec758a6e /]# xclock
Warning: Cannot convert string "" to type XftFont
[root@8200ec758a6e /]# 
If successful, this process above should have opened an xclock window on your main computer like shown below:
Congratulations!  You have just barely scratched the surface of starting to run containers with Docker.  In the next quickstart, we will create our own custom image with Postgres...