Docker is an open source project that gives us the ability to easily run applications in isolated containers. Those who use Ubuntu 22.04 LTS and want to install Docker CE to run containers of various Linux apps can follow this tutorial.
Another advantage of Docker containers is that they can build on one another and communicate with one another. Examples of these applications are an Apache server or a MySQL database.
Unlike normal virtual machines, we don’t need every container to run a complete operating system. I mean, if we want to operate a web server that is separate from the database server, we would have to start two complete virtual machines including the operating system. This is not the case with Docker, the underlying kernel will be the same and two independent containers can be started for the respective servers without installing the full-blown operating system; instead, a light Docker image does the work.
In addition, Docker is a cross-platform project, so the command is executed the same for everyone regardless of the operating system (Windows, Linux or macOS) and there are no compatibility issues between the containers.
Steps to install Docker CE on Ubuntu 22.04 LTS Jammy Jellyfish
1. System update and installation of some tools
sudo apt update sudo apt install ca-certificates curl apt-transport-https
2. Add GPG key
To download the packages from Docker on Ubuntu we need to add the GPG key that is used to sign the Docker packages by its developer, otherwise the system will return an error and will not be able to use the repository.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
3. Add the Docker repository on Ubuntu 22.04
We can install the Docker using the standard Ubuntu Jammy system repository, but the version available won’t be the latest. So, manually add Docker’s official repository using the command block given below.
Copy the quite Command block in your terminal:
echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
4. Install the Docker engine on Ubuntu 22.04
Finally, we configured all the necessary things that we needed. Now just run the System Update command to update the repository cache and update packages that have already been installed. After that, use the APT packages to get all the Docker tools we need to create containers.
sudo apt update sudo apt-get install docker-ce docker-ce-cli containerd.io
To check if the Docker service is running:
systemctl status docker
In case it doesn’t work, use:
sudo systemctl start docker
5. Use Docker without sudo
Once the installation is complete, we need to add our current system user to the Docker group, otherwise every time we ‘
sudo‘with every command of the Docker.
sudo usermod -aG docker $USER newgrp docker
To check the version:
6. Create container
Now we can start creating our first container. For example, let’s say you want to create a Debian bullseye container. To do this, we draw its Docker image.
docker pull debian
docker create -it --name test debian
docker start test
Get the command line of the installed container:
docker attach test
How to install the Ubuntu 22.04 LTS container on Docker.
Download and install Ubuntu 22.04 LTS ISO on VirtualBox