Ubuntu 无法生成任何Dockerfile
我试着用不同的答案回答我的问题,但似乎没有任何效果。 每当我尝试构建任何docker文件时,我都会收到相同的错误消息:Ubuntu 无法生成任何Dockerfile,ubuntu,docker,dockerfile,Ubuntu,Docker,Dockerfile,我试着用不同的答案回答我的问题,但似乎没有任何效果。 每当我尝试构建任何docker文件时,我都会收到相同的错误消息: E: Unable to locate package htop INFO[0000] The command [/bin/sh -c apt-get install -y htop] returned a >non-zero code: 100 以下是Dockerfile: FROM debian:latest MAINTAINER <my_email>
E: Unable to locate package htop
INFO[0000] The command [/bin/sh -c apt-get install -y htop] returned a >non-zero code: 100
以下是Dockerfile:
FROM debian:latest
MAINTAINER <my_email>
RUN apt-get update
RUN apt-get install -y htop
RUN apt-get clean
我也尝试了不同的软件包,但都有相同的错误
我得到的是:
Sending build context to Docker daemon 3.649 MB
Sending build context to Docker daemon
Step 0 : FROM debian:latest
---> 9a61b6b1315e
Step 1 : MAINTAINER anmol1696@gmail.com
---> Using cache
---> 9b4cd05e03fb
Step 2 : RUN apt-get update
---> Using cache
---> 7f4979c6993d
Step 3 : RUN apt-get install -y htop
---> Running in 7a2a26d155f5
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package htop
INFO[0000] The command [/bin/sh -c apt-get install -y htop] returned a non-zero code: 100
请帮帮我
这就是我在ubuntu的docker图像中所做的apt get update
:
Err http://archive.ubuntu.com trusty InRelease
Err http://archive.ubuntu.com trusty-updates InRelease
Err http://archive.ubuntu.com trusty-security InRelease
Err http://archive.ubuntu.com trusty Release.gpg
Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com trusty-updates Release.gpg
Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com trusty-security Release.gpg
Could not resolve 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg
Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg Could not resolve 'archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
在Dockerfile中尝试使用此选项 来自debian的
最新版本
维修人员xx
运行apt-get-update和apt-get-install-y-htop和apt-get-clean
您提供的上述Dockerfile
为我工作。尝试使用以下命令再次获取中间层:docker build--no cache=true-t。
使用的Dockerfile:
FROM debian:latest
MAINTAINER user@email.com
RUN apt-get update && \
apt-get install -y htop && \
apt-get clean
在Pritam Barāl的帮助下,我终于得到了答案。
主要问题是dns服务器,因为我在大学服务器上,没有将dns设置为可疑,这是由于IPv6配置。看 要解决这个问题:
/etc/default/docker
DOCKER\u OPTS=“--dns 8.8.8.8--dns 8.8.4.4”
服务docker restart
nope not working得到了这样的东西[Err jessie InRelease]和大量类似的错误消息stry
docker run-d ubuntu/bin/sh-c“虽然是真的;do echo hello world;sleep 1;done”
然后docker exec-it$(docker ps-lq)/bin/bash
,然后apt get update&apt get install-y htop
它能工作吗?我想知道在做任何事情之前是否需要更新/etc/apt/sources.list…此Dockerfile与我发布的类似,工作正常,因此。。。你上网了吗?ping yahoo.com或类似网站,它能工作吗?你是说ping命令吗?不,它不起作用。但是我可以连接到网络,也可以使用apt-get在主机上下载软件包。获取错误[FATA[0000]错误:我们不理解此文件。请确保它是有效的Dockerfile。分析器错误位于“MAINTAINER”]都德,我正在粘贴我使用的Dockerfile。此外,请检查internet,正如您在《获取更新》中提到的错误。实际上,您无法从源代码进行更新。列表一旦成功完成,您应该能够安装该软件包。@user2915097在这种情况下,当然:)仍然不工作。我可以在主机Ubuntu14.10上进行apt-get安装,只是没有docker映像
FROM debian:latest
MAINTAINER user@email.com
RUN apt-get update && \
apt-get install -y htop && \
apt-get clean