构建 Docker 映像时无法找到包

编程入门 行业动态 更新时间:2024-10-11 03:15:59
本文介绍了构建 Docker 映像时无法找到包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的 Docker 容器构建过程中,我尝试使用 apt-get install 安装一些软件包.但是该过程未能完成,因为 4 个包中的 3 个找不到.

During my Docker container build process, I attemptted to install a few packages using apt-get install. However the process failed to complete because the 3 of the 4 packages could not be found.

Step 1 : RUN apt-get update && apt-get install -y netcat ca-certificates build-essential libssl-dev ---> Running in 38d22d97ec4a Err http.debian jessie InRelease Err http.debian jessie-updates InRelease Err security.debian jessie/updates InRelease Err http.debian jessie Release.gpg Could not resolve 'http.debian' Err security.debian jessie/updates Release.gpg Could not resolve 'security.debian' Err http.debian jessie-updates Release.gpg Could not resolve 'http.debian' Reading package lists... W: Failed to fetch http.debian/debian/dists/jessie/InRelease W: Failed to fetch http.debian/debian/dists/jessie-updates/InRelease W: Failed to fetch security.debian/dists/jessie/updates/InRelease W: Failed to fetch http.debian/debian/dists/jessie/Release.gpg Could not resolve 'http.debian' W: Failed to fetch http.debian/debian/dists/jessie-updates/Release.gpg Could not resolve 'http.debian' W: Failed to fetch security.debian/dists/jessie/updates/Release.gpg Could not resolve 'security.debian' W: Some index files failed to download. They have been ignored, or old ones used instead. Reading package lists... Building dependency tree... Reading state information... E: Unable to locate package netcat E: Unable to locate package build-essential E: Unable to locate package libssl-dev Removing intermediate container 38d22d97ec4a 2015/08/10 12:03:07 The command [/bin/sh -c apt-get update && apt-get install -y netcat ca-certificates build-essential libssl-dev] returned a non-zero code: 100

起初,我认为这是我的基础映像的问题,但是我在另一个 VM 上构建容器没有问题.想法?

At first, I thought this was an issue with my base image, however I have no issues building the container on another VM. Thoughts?

推荐答案

这个问题围绕着主机的网络配置.eth0 接口配置不正确.以下命令帮助我确定这是 DNS 问题.

This issue revolved around the host's network configuration. The eth0 interface was improperly configured. The following commands helped me determine it was a DNS issue.

$ docker run --rm debian:jessie ping -c 5 google ping: unknown host $ docker run --rm debian:jessie ping -c 5 8.8.8.8 PING 8.8.8.8 (8.8.8.8): 56 data bytes 64 bytes from 8.8.8.8: icmp_seq=0 ttl=38 time=37.147 ms 64 bytes from 8.8.8.8: icmp_seq=1 ttl=38 time=32.917 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=38 time=31.475 ms 64 bytes from 8.8.8.8: icmp_seq=3 ttl=38 time=30.692 ms 64 bytes from 8.8.8.8: icmp_seq=4 ttl=38 time=31.180 ms --- 8.8.8.8 ping statistics --- 5 packets transmitted, 5 packets received, 0% packet loss round-trip min/avg/max/stddev = 30.692/32.682/37.147/2.352 ms

更多推荐

构建 Docker 映像时无法找到包

本文发布于:2023-10-27 04:25:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1532309.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:映像   Docker

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!