Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
996 views
in Technique[技术] by (71.8m points)

dockerfile - Docker on Ubuntu has no access to imternet

When I try to build my container I get the following errors:

E: Unable to locate package wget
E: Unable to locate package unzip
E: Package 'git' has no installation candidate
E: Unable to locate package default-jdk
The command '/bin/sh -c apt-get install wget unzip git default-jdk -y' returned a non-zero code: 100

Here's a list of commands which are supposed to be executed:

RUN apt-get update
RUN apt-get install wget unzip git default-jdk -y

From my limited understanding of linux and docker, it's clear that docker has no access to internet.

Docker version:

  • Server Version: 20.10.2
  • Docker Inc., v0.9.1-beta3
  • Docker Inc., v0.5.1-docker

Ubuntu: 16.04LTS

Things I tried:

  • added to /etc/default/docker this line DOCKER_OPTS="--ip-masq=true --dns MY_DNS1 --dns MY_DNS2"
  • commeted out #dns=dnsmasq from /etc/NetworkManager/NetworkManager.conf
question from:https://stackoverflow.com/questions/65952660/docker-on-ubuntu-has-no-access-to-imternet

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If this is not your image, then port 80:80 may not be enabled, if you have the Dockerfile, then you would be able to find out the answer. If this is your Dockerfile, then you would need to add port 80:80 unless you want to use a different port in your container to bind to port 80 on the host.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...