Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
E:在docker中找不到包wget_Docker_Debian_Apt - Fatal编程技术网

E:在docker中找不到包wget

E:在docker中找不到包wget,docker,debian,apt,Docker,Debian,Apt,我正在尝试构建以下dockerfile FROM php:8.0-apache RUN apt-get update # because apparently composer can shell out to unzip? Who knew... RUN apt-get install wget unzip zip -y 但它失败了,出现了以下错误 [root@dev svc]# docker build -t wsb -f Dockerfile . Sending build contex

我正在尝试构建以下dockerfile

FROM php:8.0-apache
RUN apt-get update
# because apparently composer can shell out to unzip? Who knew...
RUN apt-get install wget unzip zip -y
但它失败了,出现了以下错误

[root@dev svc]# docker build -t wsb -f Dockerfile .
Sending build context to Docker daemon 17.62 MB
Step 1/11 : FROM php:8.0-apache
 ---> 97f22a92e1d1
Step 2/11 : RUN apt-get update
 ---> Using cache
 ---> ddba6cf13bac
Step 3/11 : RUN apt-get install wget unzip zip -y
 ---> Running in 6fb3e2f37401
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package wget
E: Unable to locate package unzip
E: Unable to locate package zip
The command '/bin/sh -c apt-get install wget unzip zip -y' returned a non-zero code: 100
sources.list文件的现有内容

# deb http://snapshot.debian.org/archive/debian/20210511T000000Z buster main
deb http://deb.debian.org/debian buster main
# deb http://snapshot.debian.org/archive/debian-security/20210511T000000Z buster/updates main
deb http://security.debian.org/debian-security buster/updates main
# deb http://snapshot.debian.org/archive/debian/20210511T000000Z buster-updates main
deb http://deb.debian.org/debian buster-updates main
我不知道为什么它找不到。我是否应该向/etc/apt/sources.list添加任何URL以使其正常工作

编辑

Sending build context to Docker daemon 17.62 MB
Step 1/9 : FROM php:8.0-apache
 ---> 97f22a92e1d1
Step 2/9 : RUN apt-get update     && apt-get install wget unzip zip -y
 ---> Running in 374b1060dfb3

Err:1 http://security.debian.org/debian-security buster/updates InRelease
  Temporary failure resolving 'security.debian.org'
Err:2 http://deb.debian.org/debian buster InRelease
  Temporary failure resolving 'deb.debian.org'
Err:3 http://deb.debian.org/debian buster-updates InRelease
  Temporary failure resolving 'deb.debian.org'
Reading package lists...
W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease  Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease  Temporary failure resolving 'security.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease  Temporary failure resolving 'deb.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.

您缓存了一个过时的更新,因此apt正在尝试从存储库中不再存在的版本安装这些软件包。这就是为什么不提及这些步骤:

FROM php:8.0-apache
RUN apt-get update \
 && apt-get install wget unzip zip -y


从您现在看到的第二个问题来看,您的容器中存在一个网络问题。有很多可能的原因,包括主机未连接到网络,以及docker引擎启动后网络发生变化。您需要提供更多的调试(您可以从主机访问这些节点、DNS是否工作、网络上是否有代理或防火墙等)。

请分享更多详细信息。这与编程有什么关系?您试图解决什么问题?谢谢您的回答,但它不起作用。我更新了编辑部分下的输出。