Skip to main content

Docker Setup

Install

Follow Docker Installation Guide via this LINK

Setup

Start docker-client and set automatically start on boot Docker

sudo systemctl start docker && sudo systemctl enable docker

Containerd

sudo systemctl start containerd && sudo systemctl enable containerd

To stop this behavior, use disable instead.

sudo systemctl disable docker
sudo systemctl disable containerd

Run Docker Without Sudo

You can set up the Docker daemon to run without root privileges. This is a good way to avoid using sudo when you use the docker command.
Directly use the following script for a quick setup, or follow the steps below for manual operation.

Quick Setup

WGET

wget -N --no-cache --no-check-certificate https://carry0987.github.io/Linux-Note/data/Docker/docker-setup.sh && chmod +x docker-setup.sh && bash docker-setup.sh

CURL

curl -H 'Cache-Control: no-cache' -O https://carry0987.github.io/Linux-Note/data/Docker/docker-setup.sh && chmod +x docker-setup.sh && bash docker-setup.sh

Manual Setup

  1. Add docker group
sudo groupadd docker
  1. Add current user into docker group
sudo usermod -aG docker $USER
  1. Refresh group list
newgrp docker
  1. Check group
groups $USER
  1. Restart docker service
sudo systemctl restart docker
  1. Test Docker without sudo
docker info

Docker-compose (Optional)

  1. Download the corresponding Linux version of Docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/v2.24.6/docker-compose-$(uname -s)-$(uname -m)" \
-o /usr/local/bin/docker-compose
  1. Give execute permission
sudo chmod +x /usr/local/bin/docker-compose