Install Docker CE runtime on Windows Server

Docker on Ubuntu provides a platform for developing, shipping, and running applications inside lightweight, portable containers, enhancing consistency and efficiency across different environments.

Ubuntu

Tested on Ubuntu 20.04 (Focal Fossa)

Requirements

  • Internet access
  • SUDO permissions

Process

  • Update Package Repository and upgrade packages First, update your package repository to ensure you have access to the latest packages then upgrade all installed packages to the current release.
sudo apt-get update && sudo apt-get upgrade
  • Remove any pre-installed Docker packages Before you can install Docker Engine, you need to uninstall any conflicting packages.

Distro maintainers provide unofficial distributions of Docker packages in APT. You must uninstall these packages before you can install the official version of Docker Engine.

The unofficial packages to uninstall are:

docker.io docker-compose docker-compose-v2 docker-doc podman-docker

for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
  • Setup the Docker APT repository Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources:
echo \
 "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] 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
  • Install the latest Docker version This will install the latest release of Docker
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  • Test the Docker is working This will download the latest hello-world image and run it proving Docker is working.
sudo docker run hello-world
  • Add user to Docker group The Docker daemon runs as the root user. By default, other users do not have permission to interact with the Docker daemon. You can add your user to the docker group to grant this permission. Use the following command to add your user to the Docker group:
sudo usermod -aG docker $USER

References

https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository

Last modified July 21, 2024: update (e2ae86c)