To configure the MTU properly, use Docker from apt instead of snap.
If you have already installed Docker through the system installation, remove the snap version of Docker first. Otherwise, skip this step.
Remove snap version of Docker:
sudo snap remove docker
Remove old versions of Docker and Docker Compose Plugin:
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt remove -y $pkg; done
Remove old versions and install latest version of Docker and Docker Compose Plugin (New Version, Recommended)
If you encounter a permission error like the following when executing docker commands:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json": dial unix /var/run/docker.sock: connect: permission denied
You can either run docker commands with sudo, or enable a non-root user to access the docker command by following these steps:
Create the docker group on the system:
sudo groupadd -f docker
Add the active user to the docker group:
sudo usermod -aG docker $USER
Apply the group changes to the current terminal session:
newgrp docker
Check if the docker group is in the list of user groups.
groups
The group should appear in the command output.
You should now be able to issue Docker commands as a non-root user without using sudo.
Docker Compose is a tool for defining and running multi-container applications. It appears as a plugin for Docker.
You won't be required to install Docker Compose in order to use Docker, but it is recommended.
If you run into the error Cannot connect to the Docker daemon. Is 'docker daemon' running on this host? when trying to run Docker commands, you can try restarting the Docker daemon using the following command: