Docker: a Primer

René-Jean Corneille
7 min readMar 5, 2019

Docker is an application allowing to manage Linux containers on top of an existing OS. It provides a virtualisation layer (the Docker Engine) and thus any command and operations ran inside the container remain the same regardless of the OS on which Docker is set up. Docker relies solely on the host OS as a result the only compatibility issue we can run into is whether the OS supports Docker: this simplifies greatly sharing of code and transitioning from development to production.

Containers have a great advantage compared to traditional virtual machines is that they are lightweight as they do not include an OS which makes them easy to share. As a matter of fact the Docker Hub is a repository of images shared by developers and contains more than 400K images. As a good practice, I always use images from the official repository.

Screenshot of dockerhub

Docker runs natively on Linux so it is straightforward to setup on a Linux machine. In general, running Docker on anything other than Linux comes with its challenges. I focus on the basic pitfalls when working with the application on MacOS, though I still explain how to set it up on Linux distributions.

1. Installation

Docker can be installed easily on MacOS with homebrew:

$ brew install docker

--

--

René-Jean Corneille

Director of ML. I write about data science, mlops, python and sometimes C++