Docker
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://raw.githubusercontent.com/carry0987/Linux-Script/master/book_source/Docker/docker-setup.sh && chmod +x docker-setup.sh && bash docker-setup.sh
CURL
curl -H 'Cache-Control: no-cache' -O https://raw.githubusercontent.com/carry0987/Linux-Script/master/book_source/Docker/docker-setup.sh && chmod +x docker-setup.sh && bash docker-setup.sh
Manual Setup
Add
docker
groupsudo groupadd docker
Add current user into
docker
groupsudo usermod -aG docker $USER
Refresh group list
newgrp docker
Check group
groups $USER
Restart
docker
servicesudo systemctl restart docker
Test Docker without sudo
docker info
Docker-compose (Optional)
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
Give execute permission
sudo chmod +x /usr/local/bin/docker-compose