What you will read in this article will be familiarization with Docker and then how to install Docker on Ubuntu 22.04. The following content will help you to install Docker successfully and to find out how to work with images and containers. Also, you can add an image to a Docker repository.
Dockers is actually a platform that helps users to package and run applications in containers. These containers are like virtual machines and are isolated. They are also portable and compatible with resources. The isolation factor allows multiple containers to run simultaneously on a single host. Docker has a client-server structure and relies on the Docker daemon to manage containers:
Before you start the installation part, you need to prepare some requirements:
– A Linux VPS server with Ubuntu 22.04
– A non-root user with sudo privileges and a firewall
– A docker Hub account
When we want to start, the installation package in the repository may not be the latest version, So we install Docker from the official Docker repository. First, add a new package source and then install the package. Let’s update the list of packages:
sudo apt update
Now, you should install the required package that allows apt use packages over HTTPS:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
After that, you have to add the GPG key to your system for the official Docker repository:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Using this command, it is time for adding the Docker repository to apt sources:
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
To be recognized, in addition, you should update the exciting list of packages:
sudo apt update
You have to be sure to install your package from the Docker repo instead of the default Ubuntu repo:
apt-cache policy docker-ce
TIP: As you got the output, you will see that docker-ce is not installed, but it is the candidate for installation from the Docker repository for Ubuntu 22.04 (that is jammy)
Now, you can install Docker:
sudo apt install docker-ce
After all these steps, Docker can be installed, the daemon started and the process enabled until it starts again after booting the system:
sudo systemctl status docker
As you installed this platform, you will have the Docker service available and both the Docker command line tool and the Docker client.
By default, the Docker command is executed only by the main user or the user in the Docker group. But if you don’t want to log in as the sudo user, you should go through the following instructions.
To run the Docker command without sudo, add your user name to the Docker group:
sudo usermod -aG docker ${USER}
Then, to apply for the membership, exit the server and turn back in or type the following command:
su - ${USER}
Now, you should enter the user’s password to continue:
groups
Then to add a user to the Docker group that you are not logged in as notify the username explicitly using:
sudo usermod -aG docker username
When you finished all these sections, you will have the Docker platform on your system.
Here, we tried to show how to install Docker on the Ubuntu operating system. Docker is a useful assistant for you. We hope you enjoy this article. If you have any ideas or questions, just leave a comment.
Yes, Docker is free to use as part of the Docker personal subscription.
Docker doesn’t apply memory limitations to containers by default. It is possible for a Docker container to consume the entire host’s memory.
How useful was this post?
Click on a star to rate it!
Average rating 0 / 5. Vote count: 0
No votes so far! Be the first to rate this post.
Chrony is a versatile and lightweight network time synchronization software available for various Li...
MongoDB is a popular open-source NoSQL database that offers high performance, scalability, and flexi...
What is your opinion about this Blog?