Introduction to Docker

Introduction to Docker

Docker is perhaps responsible for the proliferation of containers in application development. The concept of containers is quite old, and can be traced back in the 1980s by chroot wherein different user spaces can be used within the same operating system. Once Docker was introduced however, it paved the way for further developments in containerization and changed the way how we develop and deploy software.

In this article we will discuss how to install and setup Docker in your local machine. Common Docker commands will be introduced that will equip you with foundational knowledge for tackling the next steps in application development using containers (such as Compose).

Installing Docker

The following steps are specific to most Linux distributions, but after the installation step, the concepts discussed here can be applied to any operating system.

First, we need to ensure that old versions of Docker are removed so that we can install the latest version.

sudo apt-get remove docker docker-engine docker.io containerd runc

Update your package repositories and install the requirements for Docker.

sudo apt-get update 
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common

Install Docker’s official GPG key and add the stable repository.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

Update the repositories again and install Docker CE, the CLI and associated packages. The CE means “Community Edition”, which is the free, open-source version of Docker. Docker (the company) also has an “Enterprise Edition” (EE) that is targeted specifically for businesses and large deployments. Both CE and EE share the same core features, but EE has more advanced management and support systems.

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

Note: If you encountered an error similar to the message below and you were not able to install Docker:

Package 'docker-ce' has no installation candidate read more