Overview

Containers have been around for a while, however, Docker has made the use of the container technology simple. If you are new to Docker and container technology just like me, Docker has well detailed documentation to start with. I was pretty curious on what all the fuss about containers was, therefore I started looking into container technology. Since Docker is available on many different platforms, I thought it would be appropriate to discuss as to how to setup Docker on different platforms. I will not be going into the detail of what containers are and how Docker works, this is more of how to tutorial, and me sharing my experience of setting up docker on Mac,Windows,Linux, and Azure VM.
Docker runs natively on Linux systems and uses a virtualized docker environment on Windows and Mac, I will exlore native Docker Containers on Windows in the near future. I will be using Docker for Mac and Windows, rather than using Docker Toolbox, details of which will be discussed further in the article.

Download Docker Engine

Mac

Docker can be setup on Mac either using Docker Toolbox or Docker for Mac. The key difference between the two is that the former uses VirutalBox to setup a VM to host the Docker environment and the latter is a native application that makes use of xhyve to virtualize the Docker environment, which is pretty lightweight as compared to an actual VM.
Docker for Mac requires Hypervisor to be supported by the operation system and is, therefore, applicable mostly to the newer version of Mac OS. A detailed comparison can be found at the Docker website. Downloading is pretty straight forward, and you can download the official version here.

Windows

Similar to Mac, Docker can be setup on Windows in two ways, either using Docker Toolbox or Docker for Windows. Since Docker Engine uses some Linux-specific features, therefore the former creates a VM using VirtualBox and attaches it to the host Windows machine. This VM then hosts the Docker environment required by the Windows system. The latter uses Hyper-V to virtualize the Docker enviornment. You can download Docker for Windows from here.

Linux(uBuntu)

Since Docker Engine runs natively on Linux, therefore it can be installed directly by installing the docker-engine package from apt-get. Docker is supported across various Linux distributions, however, I will be discussing setting up on Ubuntu.

Azure VM(Docker on Ubuntu)

Setting up Docker on Azure is easiest, thanks to a pre-existing template on Azure called Docker on Ubuntu Server. Docker on Ubuntu Server template deploys a Ubuntu Server 16.04 LTS VM and then automatically installs Docker Engine on the VM. The terminal on this machine can be accessed via ssh using putty on windows, for linux/mac native terminal works.

Installing Docker

Mac

Installing Docker on Mac is fairly standard and simple, once you have downloaded the dmg package, you can double-click the package file to mount dmg file. Then drag and drop Docker.app into the Applications folder as seen below.

Installing Docker on Mac
Installing Docker on Mac

Once you have successfully installed Docker.app, run the application. If everything goes well, you can see a whale icon pop up in the status bar citing that Docker is now up and running.

Successful installation
Successful installation

Windows

To install Docker on Windows, make sure Hyper-V is supported and enabled. If Hyper-V is not enabled, you can follow this tutorial to enable Hyper-V on Windows 10. Also, virtualization should be enabled on the operating system for Docker to work. Once you have both Hyper-V and virtualization enabled, run the msi installer that you downloaded, follow the instructions to install Docker and at the last dialog box tick option Launch Docker. If everything goes well, you should see a whale icon in the taskbar, which means Docker is running and ready to use.

Installing Docker on Windows
Installing Docker on Windows

Linux(uBuntu)

Since the Docker Engine is supported natively on Linux, therefore I can just install docker by running a simple script from the official Docker website. I installed Docker on Ubuntu, it is supported across many flavors of Linux. Docker on Linux can be installed using respective native package managers, however, I chose to install Docker using curl. You will need sudo permissions to install Docker, therefore make sure you have sudo privileges. Once you make sure curl is installed, you can fetch the latest Docker package as shown below.

which curl  
curl -fsSL https://get.docker.com/ | sh

Azure VM(Docker on Ubuntu)

Docker installation is probably the easiest on Azure, since you can provision a VM with Docker pre-installed. To provision, a new Ubuntu VM with Docker pre-installed follow the instructions below.

- Click the + icon to add a new resource. 
- Choose Virtual Machines.
- Search for `Docker on Ubuntu Server`.
- Configure your server and provision it.
- Once the server is provisioned, SSH into the server using an SSH client like putty.
- You will find the Docker Engine already installed.
Docker-On-Azure
Installing Docker on Azure

Verifying Docker installation

In order to verify Docker installation on each platform execute docker info to see information regarding kernel version, a number of containers and images. docker version displays all the information regarding the version of the Client and the Server, you can even format the string into JSON format.

Mac

Verify Docker installation on Mac
Verify Docker installation on Mac

Windows

Verify Docker installation on Windows
Verify Docker installation on Windows

Linux(uBuntu)

Verify Docker installation on Linux
Verify Docker installation on Linux(uBuntu)

Azure VM(Docker on Ubuntu)

Verify Docker installation on Azure VM
Verify Docker installation on Azure VM(Docker on Ubuntu)

Running hello-world image

Execute the docker run command to run the image hello-world in the container. This image is an example of minimal dockerization. You can find more images at docker explore. Run the command docker ps -a to list all containers, both running and stopped.

Mac

Running hello world on Mac
Running hello world on Mac

Windows

Running hello world on Windows
Running hello world on Windows

Linux(uBuntu)

Running hello world on Linux(uBuntu)
Running hello world on Linux(uBuntu)

Azure VM(Docker on Ubuntu)

Running hello world on Azure VM
Running hello world on Azure VM(Docker on Ubuntu)

Final note

Docker is supported mostly on all the popular platforms and setting up docker is pretty straight-forward and easy. This was just an introduction on how to setup and verify docker on various platforms. If you have any questions or concerns, feel free to leave a comment.