Skip to content

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions