User Tools

Site Tools


tech:linux

This is an old revision of the document!


AI server Build

Ubunut 24.04

Installing Docker on Ubuntu 24.04

To install Docker Engine on Ubuntu 24.04, the official and recommended method is to set up Docker's official apt repository. This ensures you get the latest stable version and automatic future updates.

Step 1: Remove Conflicting Packages

Before starting, remove any default or unofficial Docker packages to prevent conflicts:

sudo apt remove docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc

Step 2: Set Up the Docker Repository

Update your package index and install the prerequisite security certificates:

sudo apt update
sudo apt install -y ca-certificates curl gnupg

Next, add Docker's official GPG key to verify package authenticity:

sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://docker.com -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

Add the stable repository to your system's apt sources:

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://docker.com \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 3: Install Docker Engine & Plugins

Update your repository index to include Docker's packages, then install Docker Engine, the CLI, and Docker Compose V2:

sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Step 4: Verify the Installation

Check if the service is up and running:

sudo systemctl status docker

Run the default test container to verify it pulls and executes properly:

sudo docker run hello-world

Optional: Run Docker Without Sudo

By default, Docker requires root privileges. To run commands as a regular user, add yourself to the docker group:

  • Create the group (usually exists already):
sudo groupadd docker
  • Add your user to the group:
sudo usermod -aG docker $USER
  • Apply the changes immediately without logging out:
newgrp docker
  • Verify by running without sudo:
docker run hello-world

For detailed troubleshooting or specific alternative guides, you can refer to the Official Docker Engine Installation Docs.

tech/linux.1781476027.txt.gz · Last modified: by glong

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki