Welcome to this space👋. For all technology related posts: artificial intelligence and general technology demos, tech talks, cloud and web development tips, security and data best practices, look no further! ESEC BLOG APP was designed for just that!

Total Write-ups

16

Total Comments

7

Total Reactions

1055




How To Install Docker Engine On Ubuntu Server

Install Docker on Ubuntu Server

If you have any of these ubuntu versions, you can proceed:

  • Ubuntu Jammy 22.04
  • Ubuntu Impish 21.10
  • Ubuntu Focal 20.04
  • Ubuntu Bionic 18.04

First check for old docker versions and uninstall by running in cli

$ sudo apt-get remove docker docker-engine docker.io containerd runc
  • Install using repository for ease of installation and upgrade tasks.
  • Set up repository 
    run :
$ sudo apt update
$ sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release
  • Add Docker’s official GPG key: 
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  • Set up stable repository with: 
$ echo \"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  • Install Docker Engine: 
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin


The above code auto installs the latest version but to install a specific version, list the versions available by running:

$ apt-cache madison docker-ce


After, run this

 $ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io docker-compose-plugin 

where VERSION_STRING is what comes after docker-ce | and before | https... in the list of versions available.

  • To verify Docker Engine is installed: 
    run :
 $ sudo docker run hello-world


If you get an error: 
Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running?
Check status by running:

$ sudo systemctl status docker


If you get an error: 
System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down
Run this cmd if using Ubuntu 20.4 & Docker 20.10.11:

$ sudo service docker start
$ sudo docker run hello-world

and response should contain 
... Hello from Docker! This message shows that your installation appears to be working correctly ...

  • To uninstall Docker,
  • 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 images, containers, volumes, or customized configuration files on your host that are not automatically deleted after running that, run :
$ sudo rm -rf /var/lib/docker
$ sudo rm -rf /var/lib/containerd
  • To run Docker without root privileges,
run $ sudo groupadd docker
run $ sudo usermod-aG docker $USER 

where $USER is your ubuntu username.

 


reference url: None



Post Category: Installations



63 Favorites

Choose Reaction

1 👍   62 💯  


0 Comments

Add Comment

There are no comments.