To install Docker in Linux, please follow the following steps:
- Step 1: (Update Ubuntu repositories.)
In the Ubuntu terminal run the following commands (you will be asked for the super user password):
sudo apt-get update
sudo apt-get upgrade
- Step 2: (Install xorg. This is required to run Docker images with graphical interface.)
In the Ubuntu terminal run the following command (you will be asked for the super user password):
sudo apt install -y xorg xinit
- Step 3: (Install Docker.)
Run the following commands one by one:
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- Step 4: (Change Docker permissions so that the user does not need to use sudo to run Docker images.)
Run the following commands one by one:
sudo groupadd docker
sudo gpasswd -a $USER docker
- Step 5: (Test the Docker installation.)
Run the following command:
docker run hello-world
- Step 6: (Reboot.)
Reboot your computer. Docker Images with a graphical interface may not be displayed properly until you
reboot your computer
Please note that in order to run Docker images with a graphical interface you need to run the
following command first:
xhost +
You are now ready to run any pegi3s Docker image.