Docker Engine for Ubuntu is a containerization platform that enables developers to build, deploy, and manage applications in a portable and scalable manner, with features such as isolated environments, easy deployment, and version control.
- To get started with Docker Engine on Ubuntu
- Make sure you meet the prerequisites, then install Docker.
Uninstall old versions
Uninstall any such older versions before attempting to install a new version:
sudo apt-get remove docker docker-engine docker.io containerd runc
Install Using the repository
- Before you install Docker Engine for the first time on a new host machine
- You need to set up the Docker repository.
Set up the repository
- Update your system and install below packages:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
- Add Docker’s official GPG key:
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
- Use the following command to set up the repository:
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Install Docker Engine
- Update the apt package index:
sudo apt-get update
- Install Docker Engine, containerd, and Docker Compose (latest version)
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
- Verify that the Docker Engine installation is successful by running the hello-world image:
sudo docker run hello-world
- This command downloads a test image and runs it in a container.
- When the container runs, it prints a confirmation message and exits.
- You have now successfully installed and started Docker Engine.
Configure Docker to start on boot
only if you want to start on boot
To automatically start Docker and containerd on boot for other Linux distributions using systemd, run the following commands:
sudo systemctl start docker
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
To stop this behavior, use disable instead.
sudo systemctl disable docker.service
sudo systemctl disable containerd.service