Repository navigation
Description
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/containerTo reproduce, first create an internal network:
sudo container system dns create int
container system stop
container system startRun a container:
container run --rm -it --name test --dns-domain int alpine shIn 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
/ # exitCreate 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 startRun the alpine container again:
container run --rm -it --name test --dns-domain int alpine shIn 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
/ # exitThis 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.0Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
katiewasnothere commentedon Jun 24, 2026
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-domainoption 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.samerfarha commentedon Jun 25, 2026
@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!
mvanhorn commentedon Jun 26, 2026
Opened #1835 - expands the
--dns-domain/--dns-optionhelp text to say they configure the guest/etc/resolv.confand don't register DNS records (usecontainer system dns create/config.toml [dns]for that), mirrored in the command-reference and how-to docs.bittervec commentedon Jul 1, 2026
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 globalconfig.toml?jezmck commentedon Jul 7, 2026
Hit this today following the official
start-here.mdtutorial oncontainer1.1.0 (Homebrew, latest available).sudo container system dns create testcompleted successfully,/etc/resolverwas written correctly, andcontainer system dns listshowed the domain — but<container-name>.testreturned 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 listshowed an empty[dns]section —dns.domainwas never populated. Manually setting it in~/.config/container/config.toml:then restarting the service and recreating the domain/container got
.testhostnames resolving correctly.Since this is a first-run experience via the official tutorial, it might be worth
docs/tutorials/start-here.mdlinking to this issue or noting theconfig.tomlworkaround until it's fixed, so newcomers aren't stuck guessing. Happy to open a docs PR if useful.katiewasnothere commentedon Jul 9, 2026
Closing since the original issue was resolved. @jezmck feel free to open a PR! You can tag me and I'll take a look.