You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to keep container registry credentials out of the Nomad job specification. My idea was to store them in Vault and use a Nomad template to pull them. As far as I can tell, Podman doesn't let you override using a set of environment variables - rather you point it at an auth.json file on the command line, or use the REGISTRY_AUTH_FILE environment variable to tell it where to read credentials from see docs.
I did podman login on a host and noted the generated $XDG_RUNTIME_DIR/containers/auth.json file. I then grabbed the auth portion and stored it in Vault.
In the Nomad job specification I used a template to create a version of the auth file according to the format as below:
template {
data=<<EOH { "auths": { "ghcr.io": { "auth": "{{with secret "secret/data/github/creds"}}{{.Data.data.auth}}{{end}}" } } } EOHdestination="local/auth.json"change_mode="noop"# We don't care if this value changes once we are running
}
I then tried to get Podman to recognize that file using:
env {
HTTP_PORT="${NOMAD_PORT_http}"ENV="dev"# So Podman can find the auth fileREGISTRY_AUTH_FILE="${NOMAD_TASK_DIR}/auth.json"
}
Unfortunately, Podman would not pick up the credentials. I viewed the created file under local and it looked correct to me.
The tasks all failed because the container could not be pulled from the registry.
My guess is that REGISTRY_AUTH_FILE is not available to the driver, so it isn't using it?
The feature that would be useful is adding an option to point the driver at the credentials file to use.
The text was updated successfully, but these errors were encountered:
It assumes any job running on the host should have access to the same registry credentials, which might not be what you're looking for, and having nomad able to pull different registry creds from vault per job may still be handy to have.
I was trying to keep container registry credentials out of the Nomad job specification. My idea was to store them in Vault and use a Nomad template to pull them. As far as I can tell, Podman doesn't let you override using a set of environment variables - rather you point it at an
auth.json
file on the command line, or use theREGISTRY_AUTH_FILE
environment variable to tell it where to read credentials from see docs.I did
podman login
on a host and noted the generated$XDG_RUNTIME_DIR/containers/auth.json
file. I then grabbed theauth
portion and stored it in Vault.In the Nomad job specification I used a template to create a version of the
auth
file according to the format as below:I then tried to get Podman to recognize that file using:
Unfortunately, Podman would not pick up the credentials. I viewed the created file under
local
and it looked correct to me.The tasks all failed because the container could not be pulled from the registry.
My guess is that
REGISTRY_AUTH_FILE
is not available to the driver, so it isn't using it?The feature that would be useful is adding an option to point the driver at the credentials file to use.
The text was updated successfully, but these errors were encountered: