Skip to content

docs: add guidance about resolv.conf - #2450

Draft
jmarrero wants to merge 1 commit into
bootc-dev:mainfrom
jmarrero:resolv
Draft

docs: add guidance about resolv.conf#2450
jmarrero wants to merge 1 commit into
bootc-dev:mainfrom
jmarrero:resolv

Conversation

@jmarrero

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions github-actions Bot added the area/documentation Updates to the documentation label Sep 10, 2026
@bootc-bot
bootc-bot Bot requested a review from cgwalters September 10, 2026 19:04
Comment thread docs/src/building/dns.md
- Another network manager or resolver owns the file under a
distribution-specific policy.

NetworkManager and `systemd-resolved` are not alternatives with the same role.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine as is but if it got much more complex we should probably redirect to more in-depth guidance for a particular OS and/or upstream documentation (esp for NetworkManager)

Comment thread docs/src/building/dns.md
- `/etc/resolv.conf` is a symlink to a resolver file generated below
`/run/systemd/resolve`, normally
`../run/systemd/resolve/stub-resolv.conf`.
- The symlink can be created on boot if it was not materialized during the

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is what we expect to happen.

What we should be calling out here is that because of the /etc/resolv.conf being injected by container runtimes problem bootc actually always masks it (though just with the ostree backend today) see #1167

Comment thread docs/src/building/dns.md
Comment on lines +119 to +120
A base image may instead have NetworkManager or another service write a
regular `/etc/resolv.conf`. In that case it should ensure that:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write at runtime not build time, probably worth calling out

Comment thread docs/src/building/dns.md
Base image authors should select and document a resolver policy appropriate
for their distribution. Workloads that depend on particular behavior such as
`ndots`, timeouts, attempts, caching, or split DNS should be tested against
that resolver. `bootc` does not translate options between resolver

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bootc has nothing to do with /etc/resolv.conf other than the special case that we remove it if present in the container image.

I would just include links to the other relevant docs, we don't need to explain resolved vs resolv.conf semantics here.

Comment thread docs/src/building/dns.md
Comment on lines +161 to +162
A static `/etc/resolv.conf` can be appropriate for a deliberately static
system, but it is not the default recommendation. It prevents normal dynamic

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NetworkManager definitely supports configuring the DNS through it statically e.g. for a static IP address, and I think should be the preferred mechanism for systems using NM.

Comment thread docs/src/building/dns.md
1. Explicitly configure the network stack not to own `/etc/resolv.conf`.
2. Remove any inherited resolver symlink in a build step using
`RUN --network=none`.
3. Add the intended regular file from build context; do not copy the build

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will work because of the above.

If someone wants to ship a static /etc/resolv.conf in their image, at the current time we probably need to recommend a systemd tmpfiles.d unit that symlinks it, to /usr/lib/resolv.conf or something else.

But again I think this is overall a bad idea, and it's better to configure DNS through the networking system (NM or resolved).

Comment thread docs/src/building/dns.md
4. Treat its contents as machine-local configuration when deciding whether it
belongs in the reusable image or in provisioning.

Remember that `/etc` is persistent and uses a three-way merge across bootc

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right this is why I think it's better to have it be a link to a file in /run (as systemd-resolved encourages) or a symlink to a file in /usr if it's truly static.

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

Labels

area/documentation Updates to the documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants