Docker Installation

Docker Installation

Rajiv C R's photo
Rajiv C R
·Sep 22, 2022·

2 min read

Subscribe to our newsletter and never miss any upcoming articles

Table of contents

  • Docker Installation Steps:
  • Community and Social Footprints :

Docker Installation Steps:

Docker can be installed on Linux, Windows and Mac.

Let's see the installation steps on Ubuntu.

Installation of Docker Engine on Ubuntu:

Prerequisites:

To install Docker Engine, 64-bit version of one of the below Ubuntu versions is required:

  • Ubuntu Jammy 22.04 (LTS)

  • Ubuntu Impish 21.10

  • Ubuntu Focal 20.04 (LTS)

  • Ubuntu Bionic 18.04 (LTS)

1. Install using the repository:

Set up the repository and then install the Docker Engine, CLI, Containerd, and Docker Compose packages.

sudo apt-get update
sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

2. Install using the script:

The script will be downloaded from get.docker.com and runs it to install the latest stable release of Docker on Linux.

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

Installation Check:

sudo docker --version

By default, only the root user can connect to the docker daemon by cli. If you want any other user to run docker commands then you need to add the user into the docker group.

If you would like to use Docker as a non-root user, you should add your user to the “docker” group with below command.

sudo usermod -aG docker username

Example: In the above step, 'username' is replaced by 'vagrant'.

sudo usermod -aG docker vagrant

Uninstall Docker Engine:

  • Uninstall the Docker Engine, CLI, Containerd, and Docker Compose packages:
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-compose-plugin
  • To delete all images, containers, and volumes:
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

Community and Social Footprints :

Did you find this article valuable?

Support Cloudnloud Tech Community by becoming a sponsor. Any amount is appreciated!

Learn more about Hashnode Sponsors
 
Share this