Docker for Ubuntu Servers
Full installation documentation for Docker on Ubuntu can be found here. There are several ways to install but below you will find instructions for what we believe to be the most straight forward.
First thing to do is update
apt-get and then use
apt-get to install docker:
(sudo) apt-get update (sudo) apt-get install docker-ce docker-ce-cli containerd.io
You may or may not need
sudo based on how your permissions are configured. If you wish to install a specific version of docker you can do can the following commands to first list available versions and then the next to install the specific version.
apt-cache madison docker-ce sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
At the end you can test if docker was installed correctly by running:
sudo docker run hello-world
If you already have docker installed and want to update, update
apt-get and repeat the installation instructions above.
You may want to uninstall docker completely for a variety of reasons. In rare cases, uninstalling docker and reinstalling it can solve unusual bugs. To remove docker on ubuntu run the following command:
sudo apt-get purge docker-ce docker-ce-cli containerd.io
NOTE: the above command will not remove any of the images or volumes created by docker and stored in
var directories. To remove those you can run the following commands:
sudo rm -rf /var/lib/docker sudo rm -rf /var/lib/containerd
You may have an older verison of docker installed that has a different name, (
docker-engine ). This might be causing conflicts and they should be removed via the following command:
sudo apt-get remove docker docker-engine docker.io containerd runc