Docker containers not run as root have DNS failure

  • I'm not sure if this is an OMV issue, a Docker issue, a docker config issue, an image issue, or a local filesystem rights issue. It seems like some of my Docker containers that run their processes as a user other than root, have problems with DNS. For example, my Nextcloud container has been unable to check for updates. The process runs as www-data. When I run "docker -it -u www-data nextcloud /bin/bash" and then run "curl http://www.google.com", it fails to resolve the url. If I connect to the container as "docker -it nextcloud /bin/bash" and run "curl http://www.google.com" it returns data as expected.


    I checked the rights of /etc/resolve.conf and it was set to rw only for root and no other permissions (600). After setting the permissions to 644, suddenly everything worked.


    So my question is...is this issue caused by the container, by docker, by the docker config, or by the underlying FS permissions?


    I have docker using a shared folder instead of the default /var/lib/docker location. When I created the Nextcloud instance, I pointed it to the location I wanted and it created the folder for me so the rights on the "config" folder should be correct. Although the config folder is mounted to /var/www/html within the container anyways.


    I have docker running on an Ubuntu VM (completely separate from OMV), and I've never once run into this issue on it. Granted it's also using the default /var/lib/docker. When I've run into this issue on my OMV system, I would even test it on my Ubuntu system and wouldn't have the problem there.

  • Ok, so I THINK the issue might have to do with a umask issue but not sure how/where. I checked the shared folder where my docker data is stored (we'll called it /dockershare/docker/...) at /dockershare/docker/containers/xxxxxxxxxxxxxx......every single hosts and resolve.conf file were all 640 with owner of root:root instead of 644 and root:root.


    I really would love to get this fixed as it'll allow me to finally move some of my dockers off of the VM and on to OMV....as well as get rid of future headaches when I roll out future containers.

  • Well...I'm now at a point where I really don't know. I've pointed docker to a new location on my main storage disk (that is NOT a shared folder) and let it create the folder itself. Tried pulling and creating a new instance of FreshRSS (all this is while SSH in as root) just to test it out using docker-compose....failed. Loads of permission denied when it was trying to chmod during the setup. Checked to see if dockerd is running as root and it is. Decided to change it back to /var/lib/docker and try that as well. Same problem. So now I have no clue what the issue is or why I'm having it.

  • Perhaps I have the same issue, no DNS inside docker containers.


    My /etc/resolv.conf has 644 permissions. How can I solve this?


    Problematic server:

    root@mars:/# ls -la /etc/resolv.conf

    -rw-r--r-- 1 root root 71 May 16 16:48 /etc/resolv.conf


    PCduino3nano working:

    root@pcduino3nano:/# ls -la /etc/resolv.conf

    lrwxrwxrwx 1 root root 32 May 8 17:58 /etc/resolv.conf -> /run/systemd/resolve/resolv.conf


    making a symlink doesn't fix the issue




    I have this problem with Docker containers on one of my servers running OMV 5 on Debian 10.

    Code
    Temporary failure resolving

    About this setup. I have recently installed OMV 5 on two x86 and one ARM server. The problem appears just on one of server, while inside the host os dns seems to work fine, I can install and upgrade packages, in docker containers it simply does not work. I tried to followw several guides, nothing helped so far. Also restored the image and reinstalled docker several time. Also the servers have identical OS images just with a few configuration changes related to disks. I've tried this guide https://development.robinwinsl…ix-docker-networking-dns/ and this https://www.dedoimedo.com/comp…container-no-network.html On all servers I get this

    Code
    root@mars:~# docker run busybox nslookup google.com
    Server: 192.168.1.1
    Address: 192.168.1.1:53
    Non-authoritative answer:
    Name: google.com
    Address: 172.217.20.174
    *** Can't find google.com: No answer

    On two servers it works (arm and x86):

    My router is running OpenWrt 19.07, I also reboot it amd delete the dhcp leases. Which resolved the problem that the installed could not auto configure networks. I also found and started a container with X and VNC. In browsers DNS works fines, but not in apt

    24/7 PCDuino3 Nano OMV 4 (custom built armbian with debian 9), 1drive
    OMV 4, AMD A8-5600k + 16gb, 8 drives, 26TB of storage, zalman r1 with custom hdd bracing

    test OMV 5, AMD e350 + 4gb, 1 drive , DIY enclosure from Nokia D-Box 2 case.

    Edited once, last by tornadox ().

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!