正确安装docker
下面就按照网上通用的方法来安装
1.如果以前安装过老版本,请先卸载以前版本
sudo apt-get remove docker.io docker-engine
2.安装docker-ce与密钥管理与下载相关依赖工具
sudo apt-get install apt-transport-https ca-certificates curl python-software-properties software-properties-common
3.下载并安装密匙
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
如果成功则会返回OK
如果不成功(docker官方在墙外,需科学上网),则使用国内镜像源将上述命令换成 curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/debian/gpg | sudo apt-key add -
4.验证是否安装成功
sudo apt-key fingerprint 0EBFCD88
5.添加软件源
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian jessie stable"
如果要FQ的,请添加下面的源
sudo add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/debian jessie stable"
6.安装docker
首先更新软件源
sudo apt-get update
然后安装
sudo apt-get install docker-ce
安装完后可以查看版本
docker version
当然,也可以运行helloworld测试
docker run hello-world
7.配置完善docker
docker默认只能root用户启用
sudo usermod -aG docker username
用上面命令可以使docker普通用户也能
如果还是因为网络原因,docker下载镜像很慢
这里可以根据个人爱好切换加速器
编辑/etc/docker/daemon.json文件
{ "registry-mirrors": ["https://registry.docker-cn.com"] }
最后提一点,docker在deepin中默认是开机启动
# 安装chkconfig sudo apt-get install chkconfig
移除自启
sudo chkconfig --del docker
关闭开机自启就可以了