# Install Docker Engine on Ubuntu [TOC] ## Uninstall old versions ```shell for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; \ do sudo apt-get remove $pkg; done ``` ## Install using the apt repository ### Add Docker's official GPG key ```shell sudo apt update && sudo apt install -y \ ca-certificates \ curl ``` ```shell 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 ``` ### Add the repository to Apt sources ```shell echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null ``` ## Install the Docker packages ```shell sudo groupadd \ -g `id -g $USER` \ -o \ docker ``` ### Install the latest version ```shell sudo apt-get install \ sudo apt update && sudo apt install -y \ docker-ce \ docker-ce-cli \ containerd.io \ docker-buildx-plugin \ docker-compose-plugin ``` ## Manage Docker as a non-root user ### Add user to the `docker` group ```shell sudo usermod -aG docker $USER ``` ### Activate the changes to groups ```shell newgrp docker ``` :::success Or just log out and log back in. ::: ### Verify that docker can be runned without sudo ```shell docker version ``` ``` Client: Version: 26.1.3 API version: 1.45 Go version: go1.22.2 Git commit: 26.1.3-0ubuntu1~24.04.1 Built: Mon Oct 14 14:29:26 2024 OS/Arch: linux/arm64 Context: default Server: Engine: Version: 26.1.3 API version: 1.45 (minimum version 1.24) Go version: go1.22.2 Git commit: 26.1.3-0ubuntu1~24.04.1 Built: Mon Oct 14 14:29:26 2024 OS/Arch: linux/arm64 Experimental: false containerd: Version: 1.7.24 GitCommit: runc: Version: 1.1.12-0ubuntu3.1 GitCommit: docker-init: Version: 0.19.0 GitCommit: ``` ## Configure Docker to start on boot with systemd :::info On Ubuntu, the Docker daemon starts on boot by default. :::
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up