Passing credentials to nix-prefetch-docker

How do I pass credentials to nix-prefetch-docker?

I need to pull images from a registry which requires a login so I ran skopeo login which created ~/.docker/config.json. nix-prefetch-docker ignores that file and I get an authentication error. I have to run skopeo copy then nix-store --add-fixed to pull the images.

From what I can see in, prefetch docker uses skopeo, so it should pick up your creds.

That is true, but the wrapper script does this --set HOME /homeless-shelter.

1 Like

So the workaround that I now use is to basically “unwrap” the script in order to skip the resetting of the HOME variable and call .nix-prefetch-docker-wrapped directrly.

Somehow prefetching no longer works. Even after the image is downloaded the subsequent nix-build which needs it tries to download it again and fails due to the missing credentials.