Docker自定义.DEB文件位置
我必须编译自定义内核才能让Ubuntu在笔记本电脑上运行,现在我试图在上面运行Docker容器。
它生成了我安装的软件包:
- Linux-Headers-5.15.30-25.25custom_5.15.15.30-25.25custom-1_amd64.deb
- linux-image-5.15.15.30-25.330-25.25custom-dbg_5.15.15.30-25.30-25.25.25.25custom-1_amd64.deb
- linux-image-5.15.30-25.25custom_5.15.15.330-25.255.25custom-1_amd64.deb
现在,当我尝试创建docker images时,我会收到以下错误:
...
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package linux-headers-5.15.30-25.25custom
E: Couldn't find any package by glob 'linux-headers-5.15.30-25.25custom'
E: Couldn't find any package by regex 'linux-headers-5.15.30-25.25custom'
dockerfile只是拔下nvidia映像,并添加其他一些包装,并
FROM nvidia/cuda:11.4.2-devel-ubuntu18.04
ARG COMPILE_GRAPHICS=OFF
ARG DEBIAN_FRONTEND=noninteractive
USER root
RUN \
set -ex && \
apt-key update && \
apt-get update && \
apt-get install -y -q \
build-essential \
software-properties-common \
openssl \
curl && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/apt/archives/ && \
rm -rf /usr/share/doc/ && \
rm -rf /usr/share/man/
...
添加了 一些其他包裹主机PC
~$ sudo dpkg -l | grep linux-headers-5.15.30-25.2
ii linux-headers-5.15.30-25.25custom 5.15.30-25.25custom-1 amd64 Linux kernel headers for 5.15.30-25.25custom on amd64
使用上游Ubuntu内核软件包在其他机器上没有问题。
因此,猜猜Docker需要实际的软件包。如何添加自定义位置以获取软件包?
谢谢
I had to compile a custom kernel to get Ubuntu to run on my laptop and now I'm trying to run docker containers on it.
It generated packages I installed:
- linux-headers-5.15.30-25.25custom_5.15.30-25.25custom-1_amd64.deb
- linux-image-5.15.30-25.25custom-dbg_5.15.30-25.25custom-1_amd64.deb
- linux-image-5.15.30-25.25custom_5.15.30-25.25custom-1_amd64.deb
Now when I try to create docker images I get the following error:
...
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package linux-headers-5.15.30-25.25custom
E: Couldn't find any package by glob 'linux-headers-5.15.30-25.25custom'
E: Couldn't find any package by regex 'linux-headers-5.15.30-25.25custom'
The Dockerfile just pulls an nvidia image and adds some other packages required
FROM nvidia/cuda:11.4.2-devel-ubuntu18.04
ARG COMPILE_GRAPHICS=OFF
ARG DEBIAN_FRONTEND=noninteractive
USER root
RUN \
set -ex && \
apt-key update && \
apt-get update && \
apt-get install -y -q \
build-essential \
software-properties-common \
openssl \
curl && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/apt/archives/ && \
rm -rf /usr/share/doc/ && \
rm -rf /usr/share/man/
...
It is installed on the host PC
~$ sudo dpkg -l | grep linux-headers-5.15.30-25.2
ii linux-headers-5.15.30-25.25custom 5.15.30-25.25custom-1 amd64 Linux kernel headers for 5.15.30-25.25custom on amd64
There's no problem on other machines using the upstream Ubuntu kernel packages.
So guess docker needs the actual package. How can I add a custom location to fetch the packages?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我感觉到您正在混合容器内外的东西。
外部 - 在主机操作系统上,您必须编译自定义内核才能使Linux运行。到目前为止,一切都很好。
现在,您正在尝试构建一个Docker容器。因此,下一步正在容器内部发生。 Docker是轻巧的虚拟化,因此该容器与主机在同一内核上运行。由于某些软件包依赖关系是在内核的标题上,因此APT试图为它们安装Debian软件包,但找不到它们。当您运行自定义内核时,似乎很明显,并且该软件包在没有众所周知的存储库中。
为了摆脱这种情况:
I get the feeling you are mixing up what is outside and inside of a container.
Outside - on your host operating system you had to compile a custom kernel to get Linux running. So far so good.
Now you are trying to build a docker container. So the next steps are happening inside the container. Docker is lightweight virtualization therefore the container runs on the same kernel as the host. Since some package dependency is on the kernel's headers, and apt is trying to install the Debian package for them but cannot find them. Seems obvious as you are running a custom kernel and the package is in none well-known repository.
To get out of the situation: