Docker is a robust tool for running and managing containerized applications. It allows you to package your application and all its dependencies into a container(s), which can be smoothly deployed and run on any platform that supports Docker. That’s the real power of docker.
In this tutorial, we will go over the simple abd eay steps to install Docker on Ubuntu 20.04 or any other versions.
Prerequisites
Before proceeding with the installation, make sure that your system meets the following requirements:
- A 64-bit version of Ubuntu 20.04 or any other versions.
- A non-root user with
sudo
privileges.
Install Docker on Linux
Docker is available in the official Ubuntu package repository, but it is often not the latest version. To get the latest version, you can install Docker from the official Docker repository.
To install Docker from the docker official repository, follow these simple steps:
sudo apt update
- Install packages to allow ubuntu’s
apt
to use a repository over HTTPS method:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
- Download & add the Docker GPG key by entering folowing command:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- Then add the latest Docker repository from the official site:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- Now update the package index again for syncing with docker repo:
sudo apt update
- Finalyl, Install Docker desktop ubuntu:
sudo apt install docker-ce
This will install Docker and all of its dependencies on your system.
Starting and Stopping Docker
To start the Docker, enter the following command:
sudo systemctl start docker
To stop the Docker, enter the following command:
sudo systemctl stop docker
To enable the Docker to start at boot, enter the following command:
sudo systemctl enable docker
you can disable the Docker from starting at boot, for that enter the following command:
sudo systemctl disable docker
How to setup docker on ubuntu?
To use and mange the Docker, you need to run the docker
command as a non-root user. By default, only the root
user and the docker
group members have access to the Docker daemon.
To add user to docker group, enter the following command:
sudo usermod -aG docker <username>
Replace username
with the username of the user you want to add to this docker
group.
TIPS: To apply the changes, log out and log back in, or enter the following command:
newgrp docker
You can now run the docker
command without sudo
.
To test your docker ubuntu image, run the following command:
docker run hello-world
This will download and run a test container from the Docker Hub registry. If the installation is successful, you should see a message similar to the following:
Hello from Docker!
This message shows that your
In this tutorial, I’ve also answered this type of question. like,
- how to install docker on ubuntu 20.04?
- how to install docker on ubuntu 18.04?
- how to install docker on ubuntu 22.04?
- how to install docker on ubuntu 16.04?
- how to install docker on ubuntu 20.04 wsl?
- how to install docker compose ubuntu?
- how to install docker on ubuntu desktop?
- how to install docker on ubuntu ec2?
The Short Note:
I hope this helps to install docker desktop or server. Let me know if you have any questions.