docker - 无法在Docker容器中检索Debian软件包的最新版本

标签 docker debian apt-get docker-container debian-jessie

在一个docker容器(从node:9图像创建)中,我试图使用apt-get安装Stress-ng软件包。但是,由于某种原因,每次我尝试安装时都会检索该软件包的旧版本。要安装软件包,请使用以下命令:

root@7e7a683bf288:/usr/src/app# apt-get update
root@7e7a683bf288:/usr/src/app# apt-get install stress-ng

我得到以下版本:
root@7e7a683bf288:/usr/src/app# stress-ng --version
stress-ng, version 0.01.32

但是,如果可能的话,我想获取最新版本,即0.09.42-1(https://packages.ubuntu.com/cosmic/stress-ng)。我已经尝试了类似问题中的一些解决方案,但无法使其正常工作。

附加信息:
root@7e7a683bf288:/usr/src/app# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

root@7e7a683bf288:/usr/src/app# cat /etc/apt/sources.list
deb http://deb.debian.org/debian jessie main
deb http://security.debian.org/debian-security jessie/updates main
deb http://deb.debian.org/debian jessie-updates main

root@7e7a683bf288:/usr/src/app# add-apt-repository 
bash: add-apt-repository: command not found

最佳答案

您必须将不稳定的仓库添加到您的sources.list。当我这样做的时候,我仍然无法安装stress-ng,因为它说:

root@096865e3637f:/# apt-get install stress-ng
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:
 libc6-dev : Breaks: binutils (< 2.26) but 2.25-5+deb8u1 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

所以在安装之前,我必须删除binutils

也许这是您的选择。

完整的Dockerfile如下所示:
FROM node:9
RUN echo "deb http://http.us.debian.org/debian unstable main non-free contrib" >> /etc/apt/sources.list && \
echo "deb-src http://http.us.debian.org/debian unstable main non-free contrib" >> /etc/apt/sources.list && \
apt-get remove binutils -y && \
apt-get update && \
apt-get install stress-ng -y
CMD stress-ng --version
stress-ng --version:

stress-ng, version 0.09.50 💻🔥



因此,它不是0.09.42,而是最新的(不稳定的)版本-根据要求。

关于docker - 无法在Docker容器中检索Debian软件包的最新版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55266279/

相关文章:

java - 尝试使用 java 创建 debian 包

chef-infra - 缓存不同步,无法引用包文件

python - 在 Python 脚本中使用 "apt-get install xxx"

docker - 无法连接到 Docker Redis(Redis 已启动并正在运行)

nginx 错误 403 - 目录索引被禁止

LINUX:升级生产机器

macos - OS X brew 安装了 hping 但提示未找到命令

docker - 无法使用 Docker 在 Laravel 5.4 (PHP7) 中运行 cron

当 Docker 在同一个 Docker Compose 堆栈中运行时,它不会将日志发送到 fluentd

mysql - 从Windows连接到LINUX上的MYSQL数据库