1

This is such a strange situation. I'm trying to build an image, and apt-get update fails. Network works fine though. DNS is fine, I can even wget the same urls just fine!!

See terminal output :

❯ docker run -i -t python /bin/bash

root@e0264555b919:/# apt-get update
Err:1 http://deb.debian.org/debian bullseye InRelease
  Temporary failure resolving 'deb.debian.org'
Err:2 http://deb.debian.org/debian-security bullseye-security InRelease
  Temporary failure resolving 'deb.debian.org'
Err:3 http://deb.debian.org/debian bullseye-updates InRelease
  Temporary failure resolving 'deb.debian.org'
Reading package lists... Done
W: Failed to fetch http://deb.debian.org/debian/dists/bullseye/InRelease  Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://deb.debian.org/debian-security/dists/bullseye-security/InRelease  Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/bullseye-updates/InRelease  Temporary failure resolving 'deb.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.

root@e0264555b919:/# wget http://deb.debian.org/debian/dists/bullseye-updates/InRelease
--2023-01-07 11:50:33--  http://deb.debian.org/debian/dists/bullseye-updates/InRelease
Resolving deb.debian.org (deb.debian.org)... 151.101.62.132, 2a04:4e42:f::644
Connecting to deb.debian.org (deb.debian.org)|151.101.62.132|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 44066 (43K)
Saving to: ‘InRelease’

InRelease                   100%[==========================================>]  43.03K  --.-KB/s    in 0.01s

2023-01-07 11:50:33 (3.84 MB/s) - ‘InRelease’ saved [44066/44066]

root@e0264555b919:/# head InRelease
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Origin: Debian
Label: Debian
Suite: stable-updates
Version: 11-updates
Codename: bullseye-updates
Date: Sat, 07 Jan 2023 08:40:57 UTC
Valid-Until: Sat, 14 Jan 2023 08:40:57 UTC

root@e0264555b919:/# cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 1.1.1.1

root@e0264555b919:/#

Any idea on why it does that? I tried several debian based images, all the same issue!

1
  • it might be the permissions to /etc/resolv.conf. I can see it has an owner of 1000 when the root user has id 0. It obviously mounts the one I have in my host. github.com/moby/moby/issues/41229 But I cannot see why that makes apt/apt-get fail. wget works, curl works... Also apk on alpine images works fine.
    – AntouanK
    Commented Jan 7, 2023 at 22:22

2 Answers 2

0

Apparently the issue was that the docker root directory was in an ntfs partition with user ownership ( not root ).

I moved it because / was running out of space, and it seems like the /etc/resolv.conf file is mounted on all containers. apt-get didn't like that for some reason and cannot read it.

I re-installed docker with /var/lib/docker as the default root directory, and debian containers work fine now.

So, I guess I need a root owned partition to be able to move the docker root directory.

-1

This errors after type "apt-get update" looks like have not outside access. Try to test it by e.g. curl -I https://google.com or just ping google.com

9
  • Exactly, that is what I'm saying. It looks like access, but it's not! The curl command you gave me, works fine in that same container! But apt-get doesn't. Read the terminal output I pasted, you'll see what I mean.
    – AntouanK
    Commented Jan 7, 2023 at 12:02
  • Do you try use sudo? I know its root.
    – marlon
    Commented Jan 7, 2023 at 12:05
  • cannot do that. ❯ docker run -i -t python /bin/bash root@0d4f07365963:/# sudo apt-get update bash: sudo: command not found
    – AntouanK
    Commented Jan 7, 2023 at 12:12
  • In my opinion the sudo is the clue but Im not sure. Read this askubuntu.com/questions/440118/why-does-apt-get-require-sudo I have a sudo pkg on each my VM's. Type dpkg -l and check.
    – marlon
    Commented Jan 7, 2023 at 12:17
  • @marlon You use sudo to run it as root. Docker containers doesn't really have anything but root, and sudo is not the clue. Lack of privileges would not lead to this error message anyway; try it yourself - run apt update as normal user.
    – vidarlo
    Commented Jan 7, 2023 at 12:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .