root环境下进行
# 删除docker及安装时自动安装的所有包
apt-get autoremove docker docker-ce docker-engine docker.io containerd runc
# 查看docker是否卸载干净
dpkg -l | grep docker
# 删除相关的配置文件及插件
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
apt-get autoremove docker-ce-*
rm -rf /etc/systemd/system/docker.service.d
rm -rf /var/lib/docker
# 检查是否卸载完毕
docker --version
apt update
apt upgrade
apt-get install ca-certificates curl gnupg lsb-release
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
1.
apt-get install docker-ce docker-ce-cli containerd.io
2.
usermod -aG docker $USER
3
systemctl start docker
4.
apt-get -y install apt-transport-https ca-certificates curl software-properties-common
5.
service docker restart
docker run hello-world
查看下载的镜像
docker images
查看版本
docker version
vi?/etc/docker/daemon.json
#写入以下内容{ "registry-mirrors": [ "https://registry.docker-cn.com", "http://hub-mirror.c.163.com", "https://docker.mirrors.ustc.edu.cn", "https://kfwkfulq.mirror.aliyuncs.com" ] }
-------------------------------------------------
#重启docker
systemctl daemon-reload
systemctl restart docker
curl -L https://github.com/docker/compose/releases/download/v2.21.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker compose version