First steps in the world of Docker

By | February 9, 2015

Who as a developer hasn’t faced the problem of having to many database systems, web servers or application technologies installed on his PC. Every project requires a different setup for deployment and various tools to support it. Well I sure know that I’ve faced this problem on regular basis. Mostly requiring complex setups with different database technologies.

I’ve searched for a suitable solution for a long time, and tried everything I could think of. Below is just a small list of the things I tried:

  • Virtualized images with VirtualBox for each project (including all the data)
  • Everything installed on the PC
  • Offloading to development systems in the cloud

Each one of these choices solved the problem partially. But all off them had significant drawbacks. I mean who wants to have 4 different database software installed on his PC. And who would want full-blown images each at least 16GB big for every single project (I know I ran out of disk space in under half a year).

A couple of months ago I finally found a solution to some of the issues I had. The imaging software Docker, which creates layered virtual images for your need. In this you can create an image for a database, web server and much more. But for my problems I usually focused on images for the database servers.

Getting started

After installing all you need to do is find either an already build image or build one yourself. You can search for images matching your need using the registry or searching from the command line using:

docker search

This command will list all matching images, which you can then start using:

docker run

These two commands will allow you to start an image and use its contents. For example to start a Joomla container you can use:

docker run -P 80:80 --name joomla gjong/apache-joomla

This instruction will start the image with the name ‘gjong/apache-joomla’, this container is published on the registry of Docker. With the -P command you can set up a port, in this case we are binding the port 80 from the container to localhost:80. And last the –name will save the started container under that name in your docker list.

Note: with the –name command you can easily restart the container and continue in its previous state, this can be done by running:

docker start joomla


Leave a Reply