Skip to content

image/docker: use unified configfile for registries.d#753

Merged
mtrmac merged 2 commits intocontainers:mainfrom
jankaluza:registries.d-2
Apr 28, 2026
Merged

image/docker: use unified configfile for registries.d#753
mtrmac merged 2 commits intocontainers:mainfrom
jankaluza:registries.d-2

Conversation

@jankaluza
Copy link
Copy Markdown
Member

Switch registries.d loading to use configfile.Read(), enabling
unified drop-in search across /usr, /etc, and user config directories.
Files are merged with standard precedence, with higher-priority paths
masking lower ones.

Preserve explicit RegistriesDirPath override behavior.

Signed-off-by: Jan Kaluza jkaluza@redhat.com

@github-actions github-actions Bot added storage Related to "storage" package common Related to "common" package image Related to "image" package labels Apr 9, 2026
@jankaluza
Copy link
Copy Markdown
Member Author

jankaluza commented Apr 9, 2026

This depends on #711. If someone wants to review this early, check only the last commit.

Copy link
Copy Markdown
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

A first look

Comment thread image/docker/registries_d.go Outdated
Comment thread image/docker/registries_d.go Outdated
Comment thread image/docker/registries_d.go Outdated
Comment thread image/docker/registries_d.go
Comment thread image/docs/containers-registries.d.5.md Outdated
@jankaluza
Copy link
Copy Markdown
Member Author

Just a note to myself and others: this PR is waiting for new Read option from #773.

@Luap99 Luap99 added the podman 6 breaking changes that should go only into podman 6 only label Apr 21, 2026
@jankaluza
Copy link
Copy Markdown
Member Author

The skopeo tests are broken with this PR. I'm investigating why.

Copy link
Copy Markdown
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Not a review yet, just things a LLM found

Comment thread image/docker/registries_d_test.go Outdated
Comment thread image/docker/registries_d.go Outdated
Copy link
Copy Markdown
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

A full review now, ACK overall.


The skopeo tests are broken with this PR. I'm investigating why.

Yes, those failures look worrying… they don’t suggest that the configuration loading code is wrong, but at a glance I can’t see how a ~legitimately missing directory should cause a failure like that (but I didn’t investigate at all).

Comment thread image/docker/registries_d.go
Comment thread image/docker/registries_d.go Outdated
Comment thread image/docker/registries_d_test.go
Comment thread image/docker/registries_d_test.go Outdated
Comment thread image/docker/registries_d_test.go Outdated
Comment thread image/docker/registries_d_test.go
Comment thread image/docker/registries_d_test.go Outdated
Comment on lines +24 to +32
func writeDockerLookaside(t *testing.T, dir, filename, registry, lookaside string) {
t.Helper()
require.NoError(t, os.WriteFile(filepath.Join(dir, filename), []byte(fmt.Sprintf("docker:\n %s:\n lookaside: %s\n", registry, lookaside)), 0o644))
}

func writeDefaultDockerLookaside(t *testing.T, dir, filename, lookaside string) {
t.Helper()
require.NoError(t, os.WriteFile(filepath.Join(dir, filename), []byte(fmt.Sprintf("default-docker:\n lookaside: %s\n", lookaside)), 0o644))
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(Non-blocking: These are ~local to one test, so they could be placed near that test or even nested in it.)

@jankaluza
Copy link
Copy Markdown
Member Author

@Luap99 , @mtrmac , OK, the skopeo test is failing, because it creates the registries.yaml as a symlink, but we only support "regular" files in configfile:

https://github.com/containers/container-libs/blob/main/storage/pkg/configfile/parse.go#L387

I will extend that to also allow symlinks if that's fine by you.

@jankaluza
Copy link
Copy Markdown
Member Author

That fixed skopeo tests. The remaining test failures are infra issues :-(.

Comment thread storage/pkg/configfile/parse.go Outdated
Comment thread image/docker/registries_d_test.go
Comment thread image/docker/registries_d_test.go
Copy link
Copy Markdown
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

LGTM, apart from Paul’s review.

Comment thread image/docker/registries_d.go Outdated
Comment thread storage/pkg/configfile/parse.go Outdated
Replace the custom registries.d loader with `configfile.File` and
`configfile.Read`, aligning registry configuration with the standard
drop-in handling used elsewhere.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
The symlinks and other non-regular files were supported by the previous
code loading registries configuration files. This commit brings this
support back by changing the directory entry check from `IsRegular()`
to `!IsDir()`.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
@Luap99
Copy link
Copy Markdown
Member

Luap99 commented Apr 28, 2026

The usual question did you run this through podman/buildah CI? Just to ensure we do not need any code or test fixes.

@jankaluza
Copy link
Copy Markdown
Member Author

Copy link
Copy Markdown
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

LGTM, tests seems ok overall. The failures on podman are unrelated (well the system ones are because you did not rebase this PR after e1cdac7)

Try to get the habit to rebase on each push.

@Luap99
Copy link
Copy Markdown
Member

Luap99 commented Apr 28, 2026

I will merge once containers/podman#28570 lands unless @mtrmac finds something here in the meantime.

Copy link
Copy Markdown
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Thanks!

@mtrmac mtrmac merged commit 7d17294 into containers:main Apr 28, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to "common" package image Related to "image" package podman 6 breaking changes that should go only into podman 6 only storage Related to "storage" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants