Skip to content

Instantly share code, notes, and snippets.

@akshayithape-devops
Last active April 13, 2023 03:15
Show Gist options
  • Save akshayithape-devops/f7ca100ce6edf170a522816f93bac6f8 to your computer and use it in GitHub Desktop.
Save akshayithape-devops/f7ca100ce6edf170a522816f93bac6f8 to your computer and use it in GitHub Desktop.

Installation of Docker Engine on Ubuntu

Video Reference : https://www.youtube.com/watch?v=lqFvoEBHSIQ&t=5s

Supported OS :

  • Ubuntu Jammy 22.04 (LTS)
  • Ubuntu Focal 20.04 (LTS)
  • Ubuntu Bionic 18.04 (LTS)

Step By Step Installation :

  1. Uninstall Old Version(If any installed)

Older versions of Docker went by the names of docker, docker.io, or docker-engine. Uninstall any such older versions before attempting to install a new version,

sudo apt-get remove docker docker-engine docker.io containerd runc
  1. Update & upgrade the system
sudo apt-get update 
sudo apt-get -y upgrade
  1. Install the Prerequisites
sudo apt-get -y install ca-certificates curl gnupg lsb-release
  1. Set up the repository & Official GPG Key
sudo mkdir -p /etc/apt/keyrings

# Add Official GPG Key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

# Set up the repository
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
  1. Install Docker Engine

# Install Latest Version
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

OR 

# Install Specific Version 

# Check list of available versions 
apt-cache madison docker-ce | awk '{ print $3 }'

# Specific Version Here
VERSION_STRING=5:20.10.13~3-0~ubuntu-jammy
sudo apt-get install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-compose-plugin
  1. Add your user to docker group
# Add your user to the `docker` group
sudo usermod -aG docker $USER
  1. Relogin into system & verfiy that you can run docker commands without sudo.
# Relogin 

su - ${USER}

# Verify 
docker run hello-world
@SiddheshKukade
Copy link

@akshayithape-devops is the docker engine only required for Ubuntu or do we also have to install it windows ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment