N: See apt-secure(8) manpage for repository creation and user configuration details. N: Updating from such a repository can't be done securely, and is therefore disabled by default. Run 'apt list -upgradable' to see them.Get:4 bullseye-updates InRelease Į: Failed to fetch 401 Unauthorized Į: The repository ' bullseye InRelease' is not signed. $ sudo docker run -it -net=host ubuntu bashģ packages can be upgraded. Heads up for something that doesn't give me an error. I remove this container: sudo docker container rm c05ec98236f0 Which tells me that the CONTAINER ID in my case is c05ec98236f0. No wish to keep it either, so I do: sudo docker container ps -a I don't want to stay in this bad docker container so I hit Ctrl + D. The OP got Could not resolve '',īut the root cause is the same: the docker container has no access to Note how I just recreated the error described by the OP! Now to the core part of interest: $ sudo docker run -it ubuntu /bin/bash # ~10 seconds for me Optional - if you don't like to prefix docker with sudo every time: sudo usermod -aG docker $Ĭonfirm that docker is now added to your groups: id -nG Sudo apt install -y docker-ce # ~1 minute for me The command above took ~7 seconds for me. Sudo add-apt-repository "deb /linux/ubuntu $(lsb_release -cs) stable" echo "cacert=/etc/ssl/certs/ca-certificates.crt" > ~/.curlrc The second of the two commands above (one command broken up on two lines) Sudo apt install -y apt-transport-https ca-certificates \ Line: sudo apt update # took 11 seconds for me I did the following on a clean machine having nothing but Ubuntu 18.04įirst install docker. $ sudo docker run -i -t -net=host ubuntu /bin/bash Now you should have a valid /etc/nf on the host for docker to copy into the containers. Sudo ln -sf /run/systemd/resolve/nf /etc/nf Just change the symlink to point to /run/systemd/resolve/nf, which lists the real DNS servers: etc/nf is actually a symlink ( ls -l /etc/nf) which points to /run/systemd/resolve/nf (127.0.0.53) by default in Ubuntu 18.04. That will not work inside a container, so Docker will default to Google's 8.8.8.8 DNS server, which may break for people behind a firewall. Now by default it uses a local DNS cache 127.0.0.53. Ubuntu 18.04 changed to use systemd-resolved to generate /etc/nf. Restart the NetworkManager to regenerate /etc/nf : Now when you run/start a container, docker will populate /etc/nf with the values from daemon.json.įor Ubuntu 16.04 and earlier, /etc/nf was dynamically generated by NetworkManager.Ĭomment out the line dns=dnsmasq (with a #) in /etc/NetworkManager/nf Restart the docker daemon for those changes to take effect: Hardcode DNS server in docker daemon.json This is a little trickier, but it is generated dynamically, and you are not hardcoding the DNS server.ġ. This is easy, but not ideal if you expect the DNS server to change.įix the hosts's /etc/nf. If you have found that the host's /etc/nf is wrong, then you have 2 options: So if the host's /etc/nf is wrong, then so will the docker container. Docker basically copies the host's /etc/nf to the container everytime a container is started. Second thing to check is run cat /etc/nf on the host machine. If it has an invalid DNS server, such as nameserver 127.0.x.x, then the container will not be able to resolve the domain names into ip addresses, so ping will fail. , it is likely a DNS configuration.įirst thing to check is run cat /etc/nf in the docker container. If you see an error like Could not resolve. no package), then you set the DNS servers when you start the Docker daemon: If you've installed Docker via the binaries method (i.e. Once you've edited this file you'll want to restart your Docker service: You can add as many DNS servers as you want to this config. If you have the Ubuntu package installed, edit /etc/default/docker and add the following line: This fix depends on how you installed Docker: The fix is to tell Docker which DNS servers to use. Those Google servers weren't accessible from behind our firewall, which is why we couldn't resolve any URLs. I've copied over his solution for anybody that finds this question in the future. His problem was similar to mine and the solution helped me get it working. After searching some more I found this question that I wasn't able to find while searching 'docker apt-get fail'ĭocker - Network calls fail during image build on corporate network Thanks for all your help! I found out it was a dns problem and that it was because of a firewall.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |