Docker 使用 ubtuntu:trusty 并安装 python-dev

Docker with ubtuntu:trusty and installing python-dev

感谢您查看此内容。我使用 https://github.com/kartoza/docker-ssh

为 ssh 创建了一个 docker 图像

唯一不同的是我使用了ubuntu:trusty。

在此之后,我启动了容器并通过 ssh 连接到容器中,然后我尝试安装 python 并得到以下信息:

root@a20f46f358b3:/script/docker/ubuntu-trusty# sudo apt-get -qq -y --no- 
install-recommends install python-dev
E: Unable to correct problems, you have held broken packages.
root@a20f46f358b3:/peloton/peloton/script/docker/ubuntu-trusty# sudo apt-get  
install python-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
python-dev : Depends: libpython-dev (= 2.7.5-5ubuntu3) but it is not going 
to be installed
          Depends: python2.7-dev (>= 2.7.5-1~) but it is not going to be 
installed
E: Unable to correct problems, you have held broken packages.

我应该使用不同的图像来创建容器吗?

没有持有包,我执行验证无输出。

dpkg --get-selections | grep hold

关于我可以做些什么来解决这个问题有什么想法吗?非常感谢指导。

此致, ~灰烬

在 Dockerfile 中尝试

RUN apt-get update && sudo apt-get upgrade

并勾选 dependecies

apt-get install -f python2.7-dev

我最终使用了 ubuntu:16.04,这对我很有用。我将以下内容放入我的 Dockerfile

FROM ubuntu:16.04

此外,我使用了以下 运行 ssh 服务器 https://docs.docker.com/engine/examples/running_ssh_service/

希望这可以帮助 运行解决这个问题的其他人。

此致, ~灰烬