1.删除旧版本Docker,没有可以跳过
sudo apt-get remove docker docker-engine docker.io containerd runc
2.更新apt包索引并安装包,以允许apt通过HTTPS使用存储库
sudo apt-get update sudo apt-get install ca-certificates curl gnupg
3.使用以下命令设置存储库
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
4.更新软件源并安装Docker
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
5.添加docker用户组
sudo groupadd docker
6.添加当前用户到docker用户组
sudo usermod -aG docker ${USER}
7.重启docker
sudo systemctl restart docker
8.切换用户或注销重启使配置生效
su root #切换到root用户 su ${USER} #再切换到原来的应用用户以上配置才生效
参考链接:
https://docs.docker.com/engine/install/ubuntu/
https://blog.csdn.net/point0mine/article/details/79448402
标签:Engine,get,sudo,用户,apt,Ubuntu,Docker,docker From: https://www.cnblogs.com/Ragnaros-Y/p/17376785.html