Skip to content

[Bug]: internal DNS does not work (clean install) #856

Open

Description

@skinny

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

Last week I had a setup where internal DNS worked pretty well. I wiped my device and did a clean reinstallation of container 0.6.0 (and also tested a debug build on the latest github code)

I run :

container run -d --rm --name web  nginx
container run -it --rm alpine sh

/ # ping web
ping: bad address 'web'
/ # ping -4 web
ping: bad address 'web'
/ # nslookup web
Server:         192.168.2.1
Address:        192.168.2.1:53

** server can't find web: NXDOMAIN

** server can't find web: NXDOMAIN

/ # nslookup google.com
Server:         192.168.2.1
Address:        192.168.2.1:53

Non-authoritative answer:
Name:   google.com
Address: 142.250.64.174

Non-authoritative answer:
Name:   google.com
Address: 2607:f8b0:4008:815::200e

Current behavior

container name resolution does not work at all

Expected behavior

container names should resolve correctly

Environment

- OS: macOS 26.0.1
- Xcode: latest
- Container: Container CLI 0.6.0 (and latest from `main`)

Maybe I'm doing something wrong, but I expect this to work actually because it did. Please let me know if you need more information from my system

Relevant log output

N/A

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added theissue type on Nov 6, 2025
  2. seven1240 commented on Nov 7, 2025

    @seven1240

    Could be alpine related, can you try debian? I have run into this before: #480

  3. skinny commented on Nov 7, 2025

    @skinny
    Author

    Yes I also tried debian , same behavior unfortunately. I am looking for a way to debug this further as it remains a mystery why this was working properly last week and as this is such a basic scenario, I must be doing something wrong on my machine

  4. skinny commented on Nov 9, 2025

    @skinny
    Author
    sudo container system dns create mycorp
    container system property set dns.domain mycorp
    

    After a couple of hours trial and error today the lines above is what makes it work. I must have had that done during my initial testing (before wiping the device). Not sure it's in the docs yet but it definately should be in there as users might expect inter-container dns working out of the box

  5. AT-main commented on Nov 12, 2025

    @AT-main

    I ran into the same thing. Setting those properties got the containers talking to each other, but I later had to remove them when building images. With the custom DNS domain set, connections from inside the containers couldn’t reach the outside world.

    Clearing those settings fixed it for me:

    container system property clear dns.domain
    sudo container system dns rm mycorp
    container system stop && container system start

    For now, it looks like I need to toggle these settings depending on whether I’m building images or running containers.

  6. naikrovek commented on Dec 3, 2025

    @naikrovek

    This is bizarre to read, because at my employer I'm trying to do apt update from within an ubuntu container and the container can't resolve anything no matter what I do, and it doesn't matter if I'm building a container or running one. other tools which use MacOS Linux VMs (outside of container entirely) can use DNS just fine. it's like the host OS is blocking DNS resolution for things running inside container and nothing else, and I don't understand how that can happen. running version 0.7.0.

  7. jglogan commented on Dec 3, 2025

    @jglogan
    Contributor

    @naikrovek Could you provide the output of sudo lsof -i 53?

  8. naikrovek commented on Dec 3, 2025

    @naikrovek
    user@hostname ~> sudo lsof -i :53
    Password:
    COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
    ZscalerTu 575 root   16u  IPv4 0x1a4d63f6bd75d6ef      0t0  UDP 100.64.0.1:domain
    ZscalerTu 575 root   36u  IPv6 0x3dee9d9719d8ccd8      0t0  UDP [fc00::6440:1]:domain
    user@hostname ~>
    

    That answers it for me. Zscaler is bound to that port.

    I was running this command because I found #402 and read through it and sure enough, something is using port 53.

    Zscaler is ... the worst. It breaks everything.

    For those that don't know, Zscaler is a MITM cloud proxy which intercepts every HTTPS request, decrypts it, logs the requests, re-encrypts and passes it on to the server you were trying to reach as an HTTP client. it rewrites requests and responses according to rules and basically usurps TLS and makes the entire TLS superstructure of the web pointless.

  9. naikrovek commented on Dec 3, 2025

    @naikrovek

    @jglogan I answered above if you didn't already see. I can work around Zscaler with the --dns parameter for container run but that doesn't help one container resolve another. fortunately, I almost never need to do this.

  10. Tazintosh commented on Dec 4, 2025

    @Tazintosh

    Hi folks,

    Is my issue related?

    • I've set up a DNS (tested twice both with Orchard GUI and command line)
    • DNS is "cont"
    • "cont" is set as default DNS
    • container have been stop && start
    • All my containers have now DNS like "nginx.cont"

    Issue: ping containerName.cont from the host sometimes works, most of the time not.

    ping hotline.cont
    ping: cannot resolve hotline.cont: Unknown host
    

    I've tried:

    sudo dscacheutil -flushcache
    sudo killall -HUP mDNSResponder; sleep 2;
    

    --> This does not necessarily help. Doing so could make some containers to answer ping while other are still not.

  11. jglogan commented on Dec 5, 2025

    @jglogan
    Contributor

    @naikrovek Exactly. See also #345 and #817.

    Zscaler, dnsmasq, or anything else listening on port 53 creates a situation where the macOS DNS service can't start its listener on that port. Unfortunately, this behavior isn't something we have control over.

    I've created apple/containerization#436 for one possible workaround for this issue. Should we do that we can then create an issue here to plumb the feature up into container run.

  12. jglogan commented on Dec 5, 2025

    @jglogan
    Contributor

    @Tazintosh Do you see the cont domain in the output of scutil --dns?

    e.g.

    resolver #11
      domain   : test
      search domain[0] : test
      nameserver[0] : 127.0.0.1
      port     : 2053
      flags    : Request A records, Request AAAA records
      reach    : 0x00030002 (Reachable,Local Address,Directly Reachable Address)

    You should also see a configuration file on your system for the local domain:

    % cat /etc/resolver/containerization.test 
    domain test
    search test
    nameserver 127.0.0.1
    port 2053

    Also, check the output of sudo lsof -i :53.

  13. Tazintosh commented on Dec 5, 2025

    @Tazintosh

    Hi @jglogan
    I'm seeing this under "DNS Configuration" (not under "DNS configuration (for scoped queries)"

    resolver #8
      domain   : cont
      search domain[0] : cont
      nameserver[0] : 127.0.0.1
      port     : 2053
      flags    : Request A records, Request AAAA records
      reach    : 0x00030002 (Reachable,Local Address,Directly Reachable Address)
    

    Then:

    someuser@server / % cat /etc/resolver/containerization.cont
    domain cont
    search cont
    nameserver 127.0.0.1
    port 2053%       
    

    Finally:

    sudo lsof -i :53
    COMMAND   PID           USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
    mDNSRespo 229 _mdnsresponder   43u  IPv4 0x5f33a6a3de94a4df      0t0  UDP *:domain
    mDNSRespo 229 _mdnsresponder   49u  IPv6 0x616fc247567ec376      0t0  UDP *:domain
    mDNSRespo 229 _mdnsresponder   50u  IPv4 0x1c0e209ca670818d      0t0  TCP *:domain (LISTEN)
    mDNSRespo 229 _mdnsresponder   72u  IPv6 0x1c3461e474ed7309      0t0  TCP *:domain (LISTEN)
    

    Ping still not resolving.

  14. jglogan commented on Dec 6, 2025

    @jglogan
    Contributor

    How about sudo lsof -i :2053

  15. Tazintosh commented on Dec 6, 2025

    @Tazintosh
    COMMAND     PID           USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
    container 37587 someuser   12u  IPv4 0x5073de1ed066b2f1      0t0  UDP localhost:lot105-ds-upd
    

    All my container's DNS seems to resolve at the moment… It's good but I've no idea why.
    BTW, when I ping each of them one after each other, one did not resolve at first, and when I tried a second time after about a minute, it did…
    Anyway, I've the feeling the next time I'll start a container, all of this won't work anymore.

    [Edit] I was right (kind of). Less than 10s after successfully testing again pinging my DNS after this post, nothing was resolving anymore. But contrary to my feeling, it was even without a single action from me in between BTW.

  16. skinny commented on Dec 8, 2025

    @skinny
    Author

    After a couple of weeks of testing, the DNS behaviour is flaky at best. After a reboot and starting all containers everything works but after "some" time thing just start to break down. Internal DNS resolving from within the containers no longer work.

    
    scutil : 
    
    resolver #8
      domain   : eva
      search domain[0] : eva
      nameserver[0] : 127.0.0.1
      port     : 2053
      flags    : Request A records, Request AAAA records
      reach    : 0x00030002 (Reachable,Local Address,Directly Reachable Address)`
    
    
     lsof -i :53
    COMMAND   PID           USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
    mDNSRespo 184 _mdnsresponder   20u  IPv4 0x35e752c7b6a56472      0t0  UDP *:domain
    mDNSRespo 184 _mdnsresponder   21u  IPv6 0x91983a720e3b082a      0t0  UDP *:domain
    mDNSRespo 184 _mdnsresponder   22u  IPv4 0xe2b62073f159a240      0t0  TCP *:domain (LISTEN)
    mDNSRespo 184 _mdnsresponder   23u  IPv6 0x350a10b46199942d      0t0  TCP *:domain (LISTEN)
    
    
     sudo lsof -i :2053
    COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
    container 528 root   14u  IPv4 0x56db5926a6f26806      0t0  UDP localhost:lot105-ds-upd
    

    @jglogan any ideas on what I can do to pinpoint the cause of this?

  17. iliasaz commented on Jan 8, 2026

    @iliasaz

    I'm having a similar issue when building an image. No 3rd party DNS services involved. Before container system start, no one is listening on port 53.

    container system status
    apiserver is not running and not registered with launchd
    
    sudo lsof -i :53
    <nothing>
    

    Starting the container.

    container system start
    Verifying apiserver is running...
    
    container system status
    apiserver is running
    application data root: /Users/.../Library/Application Support/com.apple.container/
    application install root: /usr/local/
    container-apiserver version: container-apiserver version 0.7.1 (build: release, commit: 420be74)
    container-apiserver commit: 420be748f18afc685d11987ac5118c928e174c19
    
    sudo lsof -i :53
    <still nothing>
    
    ifconfig | grep bridge100
    <nothing>
    

    Now starting the build. The Dockerfile has the following lines in it:

    FROM internal-FQDN/os/oraclelinux:9-slim as swift-build
    COPY --from=another-internal-FQDN/path:1.50 / /
    
    container build --arch amd64 -t test .
     => [resolver] fetching image...
     => [resolver] fetching image...
     => [internal] load .dockerignore                                                                                                                                                                                                                 => => transferring context: 2B                                                                                                                                                                                                                   => [internal] load build context                                                                                                                                                                                                                 => => transferring context: 1.38GB                                                                                                                                                                                                               => CACHED .....
     => => resolve internal-FQDN/os/oraclelinux:9-slim@sha256:...
     => ERROR FROM another-internal-FQDN/path
     => => resolve another-internal-FQDN
    ------
     > FROM another-internal-FQDN
    ------
    Error: unknown (2): failed to solve: failed to load cache key: failed to do request: Head "https://another-internal-FQDN/path": dial tcp: lookup another-internal-FQDN on 192.168.64.1:53: read udp 192.168.64.2:49171->192.168.64.1:53: i/o timeout
    
    sudo lsof -i :53
    <now something starts showing up>
    
    COMMAND   PID           USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
    mDNSRespo 690 _mdnsresponder   65u  IPv4 0xa0333592b0e0ef03      0t0  UDP *:domain
    mDNSRespo 690 _mdnsresponder   70u  IPv6 0xe5346de6a26dfbe9      0t0  UDP *:domain
    mDNSRespo 690 _mdnsresponder   77u  IPv4 0xed210cd717006116      0t0  TCP *:domain (LISTEN)
    mDNSRespo 690 _mdnsresponder   78u  IPv6 0x19ee3aab42d389dc      0t0  TCP *:domain (LISTEN)
    
    
    ifconfig | grep bridge100 -A 3
    <this is new after the build attempt>
    
    bridge100: flags=8a63<UP,BROADCAST,SMART,RUNNING,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
    	options=63<RXCSUM,TXCSUM,TSO4,TSO6>
    	ether 82:a9:97:d0:2b:64
    	inet 192.168.64.1 netmask 0xffffff00 broadcast 192.168.64.255
    

    If I just do `container image pull another-internal-FQDN/path', it downloads the image just fine. But when I try to build it again, it doesn't see to use the cached image and fails on the resolver.

    Podman and docker work fine.

  18. bulebuk commented on Feb 17, 2026

    @bulebuk

    @naikrovek Exactly. See also #345 and #817.

    Zscaler, dnsmasq, or anything else listening on port 53 creates a situation where the macOS DNS service can't start its listener on that port. Unfortunately, this behavior isn't something we have control over.

    I've created apple/containerization#436 for one possible workaround for this issue. Should we do that we can then create an issue here to plumb the feature up into container run.

    I'm running into this with Container, but it hasn't been an issue with Podman, Docker Desktop, or Finch. How do the others do it? Binding to a different localhost address (e.g. 127.0.0.11) may be the way.

  19. Tazintosh commented on Apr 9, 2026

    @Tazintosh

    Hi, I've just updated from 0.7.1 to 0.11.0 and I still cannot ping my containers using their DNS.
    Even from the host computer.

    ping Hotline.cont
    ping: cannot resolve hotline.cont: Unknown host
    
  20. Tazintosh commented on May 14, 2026

    @Tazintosh

    Hi folks,
    Running 0.12.3 and DNS is still not working.
    Any news @jglogan?

  21. jmpolom commented on Jun 5, 2026

    @jmpolom

    This...was...working? And now...is not?

  22. SeniorPlayer commented on Jun 9, 2026

    @SeniorPlayer

    Hi folks, Running 0.12.3 and DNS is still not working. Any news @jglogan?

    I encountered the same issue. I solved it just create a new network.

    container system dns create box
    container system dns default set box
    container network create box
    container run .... --network box

  23. Tazintosh commented on Jun 10, 2026

    @Tazintosh

    Hi folks, Running 0.12.3 and DNS is still not working. Any news @jglogan?

    I encountered the same issue. I solved it just create a new network.

    container system dns create box container system dns default set box container network create box container run .... --network box

    Does the fact you're creating another network and specify it --network box means the DNS is not working on default network?

  24. katiewasnothere commented on Jun 10, 2026

    @katiewasnothere
    Contributor

    @Tazintosh Could you create a new issue with the details of what you're seeing and what you've tried? This issue is starting to get a bit crowded.

  25. SeniorPlayer commented on Jun 11, 2026

    @SeniorPlayer

    Hi folks, Running 0.12.3 and DNS is still not working. Any news @jglogan?

    I encountered the same issue. I solved it just create a new network.
    container system dns create box container system dns default set box container network create box container run .... --network box

    Does the fact you're creating another network and specify it --network box means the DNS is not working on default network?

    yes, I think so

  26. thromel commented on Jun 25, 2026

    @thromel

    I can reproduce this on container 1.0.0 on macOS 26.5.1, including on a custom network. This came up while testing Compose-compatible workflows via container-compose, but the failure reproduces with plain container commands.

    Environment:

    - OS: macOS 26.5.1 (25F80)
    - Xcode: 26.5 (17F42)
    - Container: container CLI version 1.0.0 (build: release, commit: ee848e3)
    - Architecture: arm64

    Minimal repro:

    container system start
    container network create appnet
    container run -d --name network-web --network appnet nginx:alpine
    container run --rm --network appnet busybox:latest nslookup network-web
    container run --rm --network appnet busybox:latest nslookup web

    Observed:

    Server:         192.168.65.1
    Address:        192.168.65.1:53
    
    ** server can't find network-web: NXDOMAIN
    ** server can't find network-web: NXDOMAIN
    

    The same container is reachable by IP from another container on the same network:

    container inspect network-web
    # network-web had 192.168.65.2/24
    
    container run --rm --network appnet busybox:latest wget -qO- http://192.168.65.2
    # returned the nginx welcome page

    The container resolver is configured to use the network gateway:

    container exec network-web cat /etc/resolv.conf
    # nameserver 192.168.65.1

    This is currently the biggest blocker for Compose-style local development because Compose service discovery expects service names such as web, db, or configured aliases to resolve between services on the same network. I avoided opening a new issue because this appears to be the same underlying "container names should resolve" problem.

  27. skinny commented on Jul 12, 2026

    @skinny
    Author

    I can confirm that @thromel's issue is present on 1.0.0 and 1.1.0 while 0.12.3 didn't have this issue with the custom network and DNS setup I described earlier. This is really blocking my uprade to any 1.x version :(.

    I followed the same reproduction path.

  28. skinny commented on Jul 14, 2026

    @skinny
    Author

    Upon further testing I found that adding

    [dns]
    domain = "appdomain"
    

    to the ~/.config/container/config.toml makes it all work again (like we did with the dns.domain system property before). appdomain corresponds to an entry created by container system dns create

  29. lenmazzone commented on Nov 14, 2026

    @lenmazzone

    Upon further testing I found that adding

    [dns]
    domain = "appdomain"
    

    to the ~/.config/container/config.toml makes it all work again (like we did with the dns.domain system property before). appdomain corresponds to an entry created by container system dns create

    This seemed to do it for me as well, came here straight from the web server tutorial. Didn't work on the first pass. To be fair, not a clean report because I also tried some of the steps above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions