首页 > 解决方案 > 如何在容器内的 debian:stretch 类型的映像中安装 open-ssh 客户端和服务器?

问题描述

我需要安装 ssh 才能运行以下命令: git+ssh://git@github.com/some_org/some_repo#egg=some_egg

这失败并出现以下错误:

Collecting athena from git+ssh://git@github.com/some_org/some_repo-py#egg=some_egg (from -r /requirements/athena.txt (line 2))
  Cloning ssh://git@github.com/some_org/some_repo to /tmp/pip-build-jx3xzcel/athena
error: cannot run ssh: No such file or directory
fatal: unable to fork
Command "git clone -q ssh://git@github.com/some_org/some_repo /tmp/pip-build-jx3xzcel/athena" failed with error code 128 in None
You are using pip version 9.0.3, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c pip3 install -r /requirements/athena.txt' returned a non-zero code: 1
Makefile:109: recipe for target 'build' failed

似乎我没有在容器中安装 ssh,因此尝试安装它。

我已经尝试使用各个页面上可用的命令在 Debian 上安装 ssh,但没有一个有效。这些命令包括安装openssh-serveropenssh-client通过apt-get

RUN      apt-get install -yqq openssh-server

我希望安装 ssh 并且 dockerfile 中的这一步是成功的,但相反,我收到以下错误:

Step 20/38 : RUN      apt-get install openssh-server
 ---> Running in e63d8d044b88
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package openssh-server
The command '/bin/sh -c apt-get install openssh-server' returned a non-zero code: 100
make: *** [dev] Error 100

标签: dockerdebian

解决方案


推荐阅读