安装一些必要的系统工具

sudo apt update
sudo apt upgrade -y
sudo apt -y install curl vim wget gnupg dpkg apt-transport-https lsb-release ca-certificates

更新并安装 Docker-CE

sudo apt -y install docker.io

开启Docker服务,并设置开机自启

sudo service docker start
sudo systemctl enable docker

配置Docker镜像加速器

您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器

sudo tee /etc/docker/daemon.json <<-'EOF'
{"registry-mirrors": ["https://hub-mirror.c.163.com"]}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
docker info

如果加速后依然很慢修改DNS配置为 8.8.8.8

安装 docker-compose

sudo curl -L "https://github.com/docker/compose/releases/download/v2.26.1/docker-compose-linux-x86_64" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version

标签: none

评论已关闭