Skip to content

Conversation

rubencosta
Copy link

What

Make use of the auth present in the default Docker config to pull images allowing K3d to pull images from private registries that have been previously authenticated with the docker login.

Why

K3d uses the docker SDK to pull images which doesn't use the stored registry auth credentials like the Docker cli does. If for example, you have to use a private registry as a proxy for pulling images like the K3s image or you want to have your own k3s image for some reason on a private registry, K3d will not be able to pull them as there's no way to authenticate. A possible workaround would be to pull the image before creating a cluster.

Implications

I don't think this introduces any breaking changes whatsoever. All the existing behaviour should remain the same.

@bluestealth
Copy link

Interesting this is almost identical to #1580 but I don't think it handles index.docker.io authentication, FWIW https://github.com/docker/cli/blob/636a4cf2dc225f0fe496ba53caeb2d216448fc4d/cli/command/image/push.go#L112 upstream treats registry.AuthConfig and config.AuthConfig as a mere wrapper.

@rubencosta
Copy link
Author

@bluestealth totally missed your PR 🤦‍♂️ . You are right, I guess that's a bit of an edge case which I didn't consider being that images will pull from docker.io by default. Happy to close this one as your implementation is more complete and probably safer as it makes use of reference for name parsing.

@rubencosta rubencosta closed this Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants