Files
natto/Tenmado/Docker.md

50 lines
1.8 KiB
Markdown
Raw Permalink Normal View History

2024-03-16 00:13:15 -07:00
## Docker Engine Installation
### Linux
Installing on Linux Systems - Debian Based - [Reference](https://docs.docker.com/engine/install/ubuntu/)
```bash
# 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:
```bash
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:
```bash
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:
```bash
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](https://docs.docker.com/engine/install/linux-postinstall/)