pull from password-protected docker-repo does not work
Version of Singularity:
2.4.2 / any
Expected behavior
sudo singularity pull docker://my.passwordprotected.dockerrepo/reponame/imagename:tag pulls and then builds
Actual behavior
ERROR Error getting token for repository ....
The issue seems to be fully related to https://github.com/moby/moby/issues/25169 Any constellation where a "docker login" fails (e.g. as sudo, headless) will currently fail because its depency on gnome-keyring. An alternative system is planned (since 2016!!) according to https://github.com/moby/moby/issues/25169
Steps to reproduce behavior
WORKAROUND docker pull from a password-protected as user from a graphical desktop (not headless) from there e.g. or upload to your own local open repo and pull it again via singularity
You should export DOCKER_USERNAME and DOCKER_PASSWORD to the environment first.
Thanks for the pointer! But this doesn't change anything for me, also didn't find a mention of these environmental variables before.
http://singularity.lbl.gov/docs-docker
Check your capitalization and spelling, and please share the full debug output and your steps so we can help.
Hi @rdwrt, can you try this:
sudo SINGULARITY_DOCKER_USERNAME=user SINGULARITY_DOCKER_PASSWORD=password singularity build imagename.simg docker://my.passwordprotected.dockerrepo/reponame/imagename:tag
The environment variables likely won't be preserved across your sudo call, so you can specify them ahead of the command, or you can export them inside a session where you are root already.
And if you have other errors, can you try running with debug, which needs the -d option, and let us know what you get?
sudo SINGULARITY_DOCKER_USERNAME=user SINGULARITY_DOCKER_PASSWORD=password singularity -d build imagename.simg docker://my.passwordprotected.dockerrepo/reponame/imagename:tag
Thanks!
Ok thanks all, it works with sudo -E singularity build ...
Now I'll look for a way to not having to put plain text password into an environment variable, but that's a different story :) no issue here anymore.
Hello @vsoch
I'm having some difficulty authenticating when pulling Docker images from Artifactory using Singularity:
singularity -d pull docker://
I've tried setting the env vars as you mention above (both as exported vars and prior to the command being executed), but this doesn't resolve the issue.
Is there a Singularity equivalent to docker login, or can we specify credentials in another manner (token file)?
I'm not the best to answer this question as the backend is different (and I wouldn't be surprised if functionality is different) but from this conversation https://github.com/sylabs/singularity/issues/693#issuecomment-385194505 it seems that support for a docker config might be possible. I'd wait to hear from sylabs on this issue, thanks!
Heya @whatsondoc what version of Singularity are you using? This functionality was un-intentionally omitted from 3.0.0 and 3.0.1, but was added back in 3.0.2 and works in 3.0.3. Check out the --docker-login option. And you can also use the $SINGULARITY_DOCKER_USERNAME and $SINGULARITY_DOCKER_PASSWORD env vars if you don't mind saving your password in plain text on your system.
Thanks @GodloveD !
Hello @GodloveD
We're on: singularity version 3.0.1-138.g963705a
So looks like we need to update - thanks!
Hello @GodloveD
Is there any part of the documentation that covers this, with some usage scenarios?
We are still struggling to use Singularity to interact with any of our containers stored in Artifactory.
Singularity version has been updated: singularity version 3.0.3-464.g6272a2a
Repeatedly being told that either:
FATAL [U=12487,P=4615] PullLibraryImage() Download did not succeed: 0
Or:
FATAL [U=12487,P=25835] PullLibraryImage() The requested image was not found in the library
It does look as though Singularity may be injecting "v1/imagefile/" into the URI:
Per line 44: https://github.com/sylabs/singularity/blob/55c4d4d528b7d225c79251ee7a2c0eebe1da849b/pkg/client/library/pull.go#L44
**url := libraryURL + "/v1/imagefile/" + libraryRef**
Is there any further debug information that would be useful to diagnose this?
@ikaneshiro ping!
Hey @whatsondoc! Are you using docker://... or library://... to pull your image? That error message looks like its trying to pull the image from the sylabs cloud library and not from a docker registry.
Also you can get debug info by running singularity with the -d flag. E.g. singularity -d pull ....
Both, actually, until we realised that library:// seems to want to add that extra string.
After re-focusing on using docker://, the errors have shifted slightly from what we were seeing before and were most recently relating to the manifest (getting onto the right track). Alas, we now have Singularity interacting & authenticating properly with the docker repo and commands are working 👍
The command syntax, should others be looking at the same thing:
$ singularity pull --docker-login docker://artifactory.<company_domain>:
We realised that you do not include the base directory in the tree in the command path (i.e. the first part of the path when looking at it through Artifactory).
The authentication piece is interesting, though. @GodloveD provided some useful context previously about using interactive --docker-login or env vars, but what about using other methods, e.g. an API key to Artifactory?
This is probably something more development-related, and perhaps @vsoch has had a chance to look at the options for interop? Along with her 50million other tasks... 😆
If we should shift this particular topic elsewhere, give an appropriate steer :-)
Functionality for managing docker credentials has been added in https://github.com/hpcng/singularity/pull/5593 that provides a way to interactively configure token based login etc, and will be available in 3.7.