1.卸载旧版docker 命令 1 sudo apt-get remove docker docker-engine docker.io
2.更新系统软件 命令
3.安装依赖包 命令 1 2 3 4 5 sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common
4.配置阿里云密钥 命令 1 curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
如出现:gpg: can’t connect to the agent: IPC connect call failed 这种问题,可以尝试: 1.sudo apt remove gpg 2.sudo apt install gnupg1 3.在执行 curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
5.配置阿里云docker镜像 命令 1 sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
6.执行安装 命令 1 sudo apt-get install docker-ce docker-ce-cli containerd.io
PS:用户组配置
docker ps -a 出现 Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json?all=1: dial unix /var/run/docker.sock: connect: permission denied sudo groupadd docker
命令 1 2 3 4 5 sudo groupadd docker #添加docker用户组 sudo gpasswd -a $USER docker #将登陆用户加入到docker用户组中 newgrp docker #更新用户组