Skip to content

[Bug]: --dns-domain doesn't appear to work #1794

Closed

Description

@samerfarha

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

Container DNS is not working as expected. The --dns-domain option doesn't seem to do anything, and in order to have a work around, you need to create the config.toml file with a DNS block.

Container was installed with brew. Upgraded to 1.0.0 from an earlier version.

$ container --version
> container CLI version 1.0.0 (build: release, commit: unspeci)

$ which container
> /opt/homebrew/bin/container

To reproduce, first create an internal network:

sudo container system dns create int
container system stop
container system start

Run a container:

container run --rm -it --name test --dns-domain int alpine sh

In the container:

/ # nslookup test.int
Server:		192.168.64.1
Address:	192.168.64.1:53

** server can't find test.int: NXDOMAIN

** server can't find test.int: NXDOMAIN

/ # exit

Create a config.toml file and restart the service:

container system stop
mkdir ~/.config/container/
echo "[dns]" > ~/.config/container/config.toml
echo "domain='int'" >> ~/.config/container/config.toml
container system start

Run the alpine container again:

container run --rm -it --name test --dns-domain int alpine sh

In the container:

/ # nslookup test.int
Server:		192.168.64.1
Address:	192.168.64.1:53

Non-authoritative answer:
Name:	test.int
Address: 192.168.64.13

Non-authoritative answer:
Name:	test.int
Address: fda5:3940:f4c:788c:f498:adff:fee1:d858

/ # exit

This also works if you remove --dns-domain int from your run command.

Problem description

I expect that DNS resolution should work even if there's no dns.domain section in the config.toml file, if --dns-domain is passed to the run command. It appears not to do anything at all, and the only way to get DNS working is to use config.toml, which limits you to one DNS domain.

It's also worth expanding the help section to indicate what options are possible for --dns-options

Environment

- OS: macOS 26.5.1 (25F80)
- Xcode: n/a
- Container: 1.0.0

Code of Conduct

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

Activity

  1. added theissue type on Jun 24, 2026
  2. katiewasnothere commented on Jun 24, 2026

    @katiewasnothere
    Contributor

    Hi @samerfarha this is working as intended. The DNS settings in config.toml configure the default DNS domain for DNS resolution on host. The --dns-domain option on a container run command just configures the DNS domains in /etc/resolv.conf in the guest for the container. This does not add any DNS entries such that the domain you specified will resolve on the host or the guest.

  3. samerfarha commented on Jun 25, 2026

    @samerfarha
    Author

    @katiewasnothere, thanks for the explanation! I hope there’ll be better documentation added. Other than this blip, I’ve been using container a bit and am liking it a lot!

  4. mvanhorn commented on Jun 26, 2026

    @mvanhorn
    Contributor

    Opened #1835 - expands the --dns-domain/--dns-option help text to say they configure the guest /etc/resolv.conf and don't register DNS records (use container system dns create / config.toml [dns] for that), mirrored in the command-reference and how-to docs.

  5. bittervec commented on Jul 1, 2026

    @bittervec

    So it appears although we are allowed to create multiple local DNS resolvers with container system dns create, DNS records will only be registered for the domain specified in global config.toml?

  6. jezmck commented on Jul 7, 2026

    @jezmck

    Hit this today following the official start-here.md tutorial on container 1.1.0 (Homebrew, latest available). sudo container system dns create test completed successfully, /etc/resolver was written correctly, and container system dns list showed the domain — but <container-name>.test returned NXDOMAIN from the port-2053 resolver regardless of container restarts, container system stop/start, or recreating the domain.

    Root cause matched what's described here: container system property list showed an empty [dns] section — dns.domain was never populated. Manually setting it in ~/.config/container/config.toml:

    [dns]
    domain = "test"

    then restarting the service and recreating the domain/container got .test hostnames resolving correctly.

    Since this is a first-run experience via the official tutorial, it might be worth docs/tutorials/start-here.md linking to this issue or noting the config.toml workaround until it's fixed, so newcomers aren't stuck guessing. Happy to open a docs PR if useful.

  7. katiewasnothere commented on Jul 9, 2026

    @katiewasnothere
    Contributor

    Closing since the original issue was resolved. @jezmck feel free to open a PR! You can tag me and I'll take a look.

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