Following this guide
Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
Add the repository to Apt sources:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] 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
Install 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
If last command cannot be executed successfully, this might be due to proxy issues.
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo touch /etc/systemd/system/docker.service.d/proxy.conf
Write to /etc/systemd/system/docker.service.d/proxy.conf
:
[Service]
Environment="HTTP_PROXY=http://<server>:<port>"
Environment="HTTPS_PROXY=http://<server>:<port>"
Environment="NO_PROXY=localhost,127.0.0.1,.example.com"
Reload to make it work:
sudo systemctl daemon-reload
sudo systemctl restart docker
- Docker的三种网络代理配置 · 零壹軒·笔记
If you would like to use other mirrors:
Create /etc/docker/daemon.json
:
{
"registry-mirrors" : [
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn",
"https://cr.console.aliyun.com",
"https://mirror.ccs.tencentyun.com"
]
}
Reload to make it work:
sudo systemctl daemon-reload
sudo systemctl restart docker
- docker更换镜像源 - 简书
Install docker-compose
References: