How to Install Docker Engine (Not a Legacy Version!) on Ubuntu Bionic or Focal

In some cases, you may get stuck due to docker and docker compose version.
Let's follow up on docker official documentation:

1apt remove docker docker-engine docker.io containerd runc    # purging the legacy version if exists
2apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
3curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
4apt-key fingerprint 0EBFCD88
5add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
6apt update && apt install docker-ce docker-ce-cli containerd.io

Very awesome! What about the docker-compose which is a pretty cool stuff?

1curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o docker-compose
2chmod +x docker-compose
3echo $PATH
4mv docker-compose /usr/sbin/    # In case Bionic or Focal

You should be eager to run docker as a non-root user!

1sudo groupadd docker
2sudo usermod -aG docker $USER
3sudo reboot -h now

Very cool!
Happy dockerizing gents! 😎

comments powered by Disqus