Docker 软件包无法从 debian 安装,但可以从 ubuntu 安装

Docker 软件包无法从 debian 安装,但可以从 ubuntu 安装

Debian jessie 没有官方的 Docker 软件包。有一个向后移植,我已经安装了它,但是当启动时,它会为运行容器等关键任务发出错误。

互联网上有一个建议的解决方案(关于 Debian docker 安装):添加deb https://get.docker.com/ubuntu docker main到 resources.list 然后:

sudo apt-get update
sudo apt-get install lxc-docker

看起来(我在评论中读到过)Docker 保证他们的软件包可以在 Ubuntu 和 Debian 上运行。

事实上,这个安装在我的 Ubuntu 14.04 笔记本电脑上表现良好,并且 docker 运行容器也很好。

然而,当使用 Debian jessie 在服务器上尝试相同的操作时,我无法安装 docker:

myuser@srv:~$ sudo apt-get install lxc-docker
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package lxc-docker

我还尝试使用包名称 docker.io,这是过时的 docker 包的名称:

myuser@srv:~$ sudo apt-get install docker.io
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package docker.io is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'docker.io' has no installation candidate

知道可能出什么问题吗?


这是我放入的 docker.list 文件/etc/apt/sources.list.d

deb https://get.docker.com/ubuntu docker main

权限看起来很正常:

$ ls -l /etc/apt/sources.list.d/docker.list
-rw-r--r-- 1 root root  46 Sep 20 17:26 docker.list


按照建议,我(再次)安装了 docker.io backport 包,它给了我错误:

无法启动容器:

myuser@srv:/etc/apt/sources.list.d$ sudo docker run --rm hello-world
FATA[0000] Post http:///var/run/docker.sock/v1.18/containers/create: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS? 

sudo apt-get remove但更糟糕的是,现在docker.io 向后移植包是不可能的:

Removing docker.io (1.6.2~dfsg1-1~bpo8+1) ...
[....] Stopping Docker: dockerstart-stop-daemon: warning: failed to kill 23321: No such process
1 pids were not killed
No process in pidfile '/var/run/docker-ssd.pid' found running; none killed.
invoke-rc.d: initscript docker, action "stop" failed.
dpkg: error processing package docker.io (--remove):
 subprocess installed pre-removal script returned error exit status 1
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 docker.io
E: Sub-process /usr/bin/dpkg returned an error code (1)

并且包裹永远不会被移除。这就是我昨天重新安装 debian 的原因,并选择给面向 docker 的解决方案一个机会使用 deb https://get.docker.com/ubuntu docker main

这可能与这个问题有关:如果 docker 从未工作过,则无法卸载


感谢上面的链接,禁止删除 docker.io 包的罪魁祸首是在预删除脚本中:

/var/lib/dpkg/info/docker.io.prerm

我已经修改了它,注释了尝试执行docker stop以下操作的 3 行:

# Automatically added by dh_installinit
#if [ -x "/etc/init.d/docker" ] && [ "$1" = remove ]; then
#   invoke-rc.d docker stop || exit $?
#fi

并且包裹被很好地移除了。 (昨天因为这个我真的是一个野蛮人重新安装debian......)

答案1

我非常确定 Debian jessie 有一个docker.io软件包,但您必须启用jessie-backports.

要启用jessie-backports,只需在您的文件中添加以下行/etc/apt/sources.list

deb http://http.debian.net/debian jessie-backports main

然后,更新你的包库:

$> sudo apt-get update

现在,您应该能够安装该docker.io软件包:

$> sudo apt-get install docker.io

完成此操作后,您可以通过以下方式检查一切是否正常:

$> sudo docker run --rm hello-world

您可以找到我在这里解释的内容的摘要这一页

相关内容