Files
natto/Tenmado/Docker.md
2024-03-16 00:13:15 -07:00

1.8 KiB
Raw Blame History

Docker Engine Installation

Linux

Installing on Linux Systems - Debian Based - Reference

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
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:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] 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

[!NOTE] Note If you use an Ubuntu derivative distro, such as Linux Mint, you may need to use UBUNTU_CODENAME instead of VERSION_CODENAME Remeber to replace the VERSION from the above command

To get the VERSION_CODE run:

lsb_release -a # Prints your installed Ubuntu/Debian Based OS Version
lsb_release -cs # Prints only the OS Version ex. jammy

cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2 # If for some reason "lsb_release" is not available

Install the Docker packages:

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

Verify that the Docker Engine installation is successful by running the hello-world image:

sudo docker run hello-world

[!tip] Tip Receiving errors when trying to run without root?

The docker user group exists but contains no users, which is why youre required to use sudo to run Docker commands.

Follow the following guide to add docker user to avoid running sudo docker commands - Manage Docker as a non-root user