移除之前安装的docker
sudo apt-get remove docker.io docker-engine
安装密钥管理与下载相关的工具
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
下载并安装密钥
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
查看密钥是否安装成功
sudo apt-key fingerprint 0EBFCD88
在 source.list 中添加 docker-ce 软件源
sudo add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/debian wheezy stable"
运行上面命令若报如下错误(15.11)
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 95, in <module>
sp = SoftwareProperties(options=options)
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 109, in __init__
self.reload_sourceslist()
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 599, in reload_sourceslist
self.distro.get_sources(self.sourceslist)
File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 93, in get_sources
(self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Deepin/stable
则编辑(sudo vim /etc/apt/sources.list) 添加一行即可,原因未知
deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/debian stretch stable
## Generated by deepin-installer
deb [by-hash=force] http://packages.deepin.com/deepin lion main contrib non-free
#deb-src http://packages.deepin.com/deepin lion main contrib non-free
# docker
deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/debian stretch stable
更新安装
sudo apt-get update
sudo apt-get install docker-ce
让普通用户也能运行 docker
sudo usermod -aG docker $USER
网友评论