Reputation: 1
I tried different answers to my question but nothing seems to work. When ever I try to build any docker file I end up with the same error message:
E: Unable to locate package htop
INFO[0000] The command [/bin/sh -c apt-get install -y htop] returned a >non-zero code: 100
Here is the Dockerfile:
FROM debian:latest
MAINTAINER <my_email>
RUN apt-get update
RUN apt-get install -y htop
RUN apt-get clean
The command that I run is:
sudo docker build -t demo .
I tried different packages also but all have same error.
What I get is:
Sending build context to Docker daemon 3.649 MB
Sending build context to Docker daemon
Step 0 : FROM debian:latest
---> 9a61b6b1315e
Step 1 : MAINTAINER [email protected]
---> 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
Please help me.
This is what I get doing apt-get update
in the docker image of ubuntu:
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.
Upvotes: 0
Views: 914
Reputation: 315
As suspected, this is due to IPv6 config. See here.
To solve the problem:
/etc/default/docker
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
service docker restart
Upvotes: 1
Reputation: 1
I finally got the answer with the help of Pritam Barāl. The main problem was the dns sever as i was on the university server which did not set a DNS
Upvotes: 0
Reputation: 9403
The above Dockerfile
you gave, worked for me. Try fetching the intermediate layers again with: docker build --no-cache=true -t <tag> .
Dockerfile used:
FROM debian:latest
MAINTAINER [email protected]
RUN apt-get update && \
apt-get install -y htop && \
apt-get clean
Upvotes: 1
Reputation: 32156
try with this in your Dockerfile
FROM debian:latest
MAINTAINER xx <[email protected]>
RUN apt-get update && apt-get install -y htop && apt-get clean
Upvotes: 0