To ensure Docker has been installed correctly, you can check the installed version of Docker.
1
docker --version
This should display the version of Docker installed on your system. You can also run a simple Docker command such as:
1
sudo docker run hello-world
This command downloads a test image and runs it in a container. If it runs without errors, it’s a good indication that Docker is functioning correctly.
Remember, in order to run Docker commands as a non-root user without prepending sudo, you need to add the user to the docker group:
1
sudo usermod -aG docker $USER
Then you need to log out and log back in so that your group membership is refreshed.
That’s it! You have successfully installed Docker.
Debian 11
To install Docker on Debian 11, follow these steps:
Step 1: Update the System
First, update your existing list of packages:
1
sudo apt update
Next, upgrade the packages:
1
sudo apt upgrade -y
Step 2: Install the Necessary Software
Docker requires some packages that are not installed by default, including packages to allow apt to use a repository over HTTPS:
Finally, verify that Docker CE is installed correctly by running the hello-world Docker image:
1
sudo docker run hello-world
This command downloads a test image and runs it in a container. If it runs successfully, it prints an informational message and exits.
You should now have Docker installed on your Debian 11 system. If you want to run Docker commands as a non-root user without prepending sudo, you’ll need to add your user to the docker group:
1
sudo usermod -aG docker ${USER}
You may need to log out and back in for these changes to take effect.
Red Hat 9
Red Hat Enterprise Linux 9 has removed Docker from its official repositories. However, you can still install Docker using other methods.
One such alternative is using Podman, which is a daemonless container engine for developing, managing, and running OCI Containers on your Linux System. Containers can either be run as root or in rootless mode.
If you want to install Docker, here is a way to do it:
Verify that Docker Engine is installed correctly by running the hello-world image:
1
sudo docker run hello-world
Enable Docker to start on boot:
1
sudo systemctl enable docker
Please note that the installation process might slightly differ based on the exact version of your RHEL system and the system setup. If any of the steps does not work as expected, refer to the Docker official documentation.
Remember that using Docker requires root privileges so make sure to use sudo with Docker commands, or give Docker these privileges correctly.
If you want to use a more RHEL native solution, consider using Podman and Buildah. These tools provide similar functionalities to Docker but are designed with a different architecture that doesn’t require a daemon and run as a normal user.
Also, be aware that running the Docker daemon on your system can have security implications; you should understand these before deciding to use Docker.