0

I have a docker container that I am trying to build. Unfortunately, I cannot install anything inside of it. apt-get update does not function at all. What is strange is that I can curl the files just fine. I don't quite understand what is going on here.

Ping seems to be working just fine:

root@1605103d18c0:/# ping ports.ubuntu.com -c 3
PING ports.ubuntu.com (91.189.88.150) 56(84) bytes of data.
64 bytes from astomi.canonical.com (91.189.88.150): icmp_seq=1 ttl=51 time=91.2 ms
64 bytes from astomi.canonical.com (91.189.88.150): icmp_seq=2 ttl=51 time=89.3 ms
64 bytes from astomi.canonical.com (91.189.88.150): icmp_seq=3 ttl=51 time=88.4 ms

--- ports.ubuntu.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 88.440/89.672/91.246/1.170 ms

curl works just fine (I piped it into wc -c to just report the downloaded size)

root@1605103d18c0:/# curl http://ports.ubuntu.com/ubuntu-ports/dists/bionic/InRelease | wc -c
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  236k  100  236k    0     0   403k      0 --:--:-- --:--:-- --:--:--  403k
242048

apt update and apt-get update both fail with a failure to resolve.

root@1605103d18c0:/# apt update
Err:1 https://repo.nordvpn.com/deb/nordvpn/debian stable InRelease
  Temporary failure resolving 'repo.nordvpn.com'
Err:2 http://ports.ubuntu.com/ubuntu-ports bionic InRelease
  Temporary failure resolving 'ports.ubuntu.com'
Err:3 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease
  Temporary failure resolving 'ports.ubuntu.com'
Err:4 http://ports.ubuntu.com/ubuntu-ports bionic-backports InRelease
  Temporary failure resolving 'ports.ubuntu.com'
Err:5 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease
  Temporary failure resolving 'ports.ubuntu.com'
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/bionic/InRelease  Temporary failure resolving 'ports.ubuntu.com'
W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/bionic-updates/InRelease  Temporary failure resolving 'ports.ubuntu.com'
W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/bionic-backports/InRelease  Temporary failure resolving 'ports.ubuntu.com'
W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/bionic-security/InRelease  Temporary failure resolving 'ports.ubuntu.com'
W: Failed to fetch https://repo.nordvpn.com/deb/nordvpn/debian/dists/stable/InRelease  Temporary failure resolving 'repo.nordvpn.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Eliah Kagan
  • 116,445
  • 54
  • 318
  • 493
RFBomb
  • 1
  • 1
  • 1
    I am at home. The container can ping multiple DNS servers just fine from within the container. Apt-Get update is working just fine on the host (raspberry pi) . I was also able to run apt-get update when actually building the container from the dockerfile. But for some reason, it is no longer able to use apt-get once its been tagged (but curl works fine on the same address, so I highly doubt its a proxy issue) – RFBomb Dec 27 '19 at 01:49
  • Do you have any proxy configured for APT? Look in `/etc/apt/apt.conf` and `/etc/apt/apt.conf.d/*` – Mukesh Sai Kumar Dec 27 '19 at 05:30
  • Add the output of `apt-config dump` to your question – Mukesh Sai Kumar Dec 27 '19 at 05:31
  • Here is what solved it for me: https://askubuntu.com/questions/1162163#1162198. – Henke Oct 31 '20 at 12:47
  • Does this answer your question? [What is correct way to fix name resolution from Docker container?](https://askubuntu.com/questions/1162163/what-is-correct-way-to-fix-name-resolution-from-docker-container) – Henke Nov 02 '20 at 18:01
  • Does this answer your question? [apt-get update fails to fetch files, “Temporary failure resolving …” error](https://askubuntu.com/questions/91543/apt-get-update-fails-to-fetch-files-temporary-failure-resolving-error) – karel Nov 02 '20 at 22:46

1 Answers1

0

docker-compose.yml

version: "3.7"
services:
  app:
    build:
      network: host
      dockerfile: dockerfiles/application.Dockerfile

Use host networking