Introduction to Docker- A step by step guide to learn docker: Part 2

Anil Kumar
4 min readMay 9, 2021

How to install Docker?

In this part of the tutorial, we will see the installation process of Docker on different platforms.

I hope you have already read the previous part (part 1) of the tutorial, If not then I recommend you to go through Part 1 once.

In case you are already aware of the basics of Docker, then it’s completely fine, we can go ahead.

Let’s start the installation process.

Install and run Docker Desktop on Mac

  1. Download docker application from docker as per your MacBook config (M1 chip or Intel chip)
  2. Double-click Docker.dmg to open the installer, then drag the Docker icon to the Applications folder.

3. Double-click Docker.app in the Applications folder to start Docker. (In the example below, the Applications folder is in “grid” view mode.)

Install Docker Desktop on Windows

  1. Download the docker application from docker.
  2. Double-click Docker Desktop Installer.exe to run the installer.
  3. When prompted, ensure the Enable Hyper-V Windows Features or the Install required Windows components for WSL 2 option is selected on the Configuration page.
  4. Follow the instructions on the installation wizard to authorize the installer and proceed with the install.
  5. If your admin account is different from your user account, you must add the user to the docker-users group. Run Computer Management as an administrator and navigate to Local Users and Groups > Groups > docker-users. Right-click to add the user to the group. Log out and log back in for the changes to take effect.
  6. Start Docker Desktop. Docker Desktop does not start automatically after installation. To start Docker Desktop, search for Docker, and select Docker Desktop in the search results.

Install Docker Engine on Ubuntu

Older versions of Docker were called docker, docker.io, or docker-engine. If these are installed, uninstall them:

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

Update your existing list of packages:

sudo apt-get update

Next, install a few prerequisite packages which let apt use packages over HTTPS:

sudo apt install apt-transport-https ca-certificates curl software-properties-common

Then add Docker’s official GPG key:

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

Add the Docker repository to APT sources:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"

Next, update the package database with the Docker packages from the newly added repo:

sudo apt update

Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:

apt-cache policy docker-ce

You’ll see output like this, although the version number for Docker may be different:

Notice that docker-ce is not installed, but the candidate for installation is from the Docker repository for Ubuntu 18.04 (bionic).

Finally, install Docker:

sudo apt install docker-ce

Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:

sudo systemctl status docker

Congratulations! 💥💥 You are now successfully running Docker.

Conclusion

Till now we have learned the basics of Docker and the installation process.

if you are facing any issues while installation, please go through the docker’s official installation process.

In the next part, we will go through some basic commands and dockerize a Node.js application. See u in the next section.

References:

--

--

Anil Kumar

I am a software developer with a specialization in creating scalable and efficient web applications using Node.js.