How to run Docker

There is conventional wisdom that Docker is pretty much diversed and sophisticated tool, but recently there were gorgeous updates which make it much simpler and convenient to use.

So I guess it is good time to summarise knowledge about design and deployment details for everyone who starts working with Docker.

Docker design at glance

Docker provides appliance to run your application inside isolated Linux environment aka Docker container. This container is just lightweight simulation of Linux OS, which is intended to host single user application and isolate applications from each other.

This makes mental shift from running multiple applications on Linux OS to running multiple containers hosted inside Linux core.

This provides multiple advantages like:

  • Declarative and reproducible application definition
  • Simplified and automated application deployment
  • Applications isolation from each other
How to run Docker

There were troublous times when you had to setup docker differently depending on you host OS. After releasing Docker Toolbox this process is got to be standardised.

Lets go step by step to install and run docker on MacOS or Windows operating systems.

Step 1: install Docker

You should download and install following applications:

  1. Install Virtual Box
  2. Install Docker Toolbox
Step 2: configure Docker

There is additional concept needed to run Docker - docker-machine. It is responsible to setup and run Docker containers inside virtual machine with Linux (as containers could be run only inside linux core).

To configure Docker you need to initialise docker-machine with following command:

docker-machine create --driver virtualbox default  

It will create virtual machine with tiny Linux core which will host Docker containers.

After docker machine created the last step is to set 3 environment variables:


To get values for this variables you could run docker-machine env command. There should be output like following:

>>Alex$ docker-machine env
export DOCKER_TLS_VERIFY="1"  
export DOCKER_HOST="tcp://"  
export DOCKER_CERT_PATH="/Users/Alex/.docker/machine/machines/default"  


Now you have docker up and running, to assure all is fine run
docker ps command.