在Ubuntu上安装
添加软件源
添加docker官方GPG密钥并载入密钥:
curl -fsSL [https://download.docker.com/linux/ubuntu/gpg](https://download.docker.com/linux/ubuntu/gpg) | sudo apt-key add -
设置deb官方源,编辑/etc/apt/sources.list文件,末尾添加下列内容:
deb [https://download.docker.com/linux/debian](https://download.docker.com/linux/debian) stretch stable
更新软件源
安装软件
在CentOs、阿里云Linux上安装
安装运行环境
安装编译器:
yum -y install gccyum -y install gcc-c++
安装yum-utils:
安装软件源
yum-config-manager --add-repo [https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo](https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo)
更新yum软件源
安装软件
用户组设置
添加docker用户组
将当前用户加入docker用户组
sudo gpasswd -a $USER docker
如果需要加其他用户到docker用户组,将$USER替换成指定的用户名即可。
更新用户组
设置docker国内源
在阿里云工作台找“容器镜像服务”-“镜像工具”-“镜像加速器”,找到加速器配置脚本,复制粘贴执行。
sudo mkdir -p /etc/dockersudo tee /etc/docker/daemon.json <<-'EOF'{"registry-mirrors": ["https://puiev2e1.mirror.aliyuncs.com"]}EOFsudo systemctl daemon-reloadsudo systemctl restart docker
卸载Docker
卸载软件
sudo yum remove docker-ce docker-ce-cli containerd.io
删除配置
删除容器
rm -rf /var/lib/containerd
