CLI - Drone exec with private registry - 8.x

I’m trying to use the drone exec command locally with images that are in a private quay.io registry. I’ve tried the normal docker login but it seems like drone sets it up differently. Is there a convenient way to pass the auth for the registry to drone to be able to pull the images down?

The drone exec command doesn’t provide any way to authenticate to a registry. It is currently designed to use the local docker cache, which means you would need to docker pull any required private images prior to running the command.

1 Like

Hey, has this issue been adressed in more recent versions of drone client? Is there any other workaround beside having to docker pull images first?

You can use the --registry flag to pass registry credentials to the CLI

drone exec --registry=https://octocat:[email protected]

Or if you source registry credentials from a secret using the image_pull_secrets block you can pass the secret to the CLI via the secrets file.

Example yaml with image_pull_secrets:

image_pull_secrets:
- dockerconfigjson

Example command that passes file via flag:

drone exec --secret-file=path/to/file

Example secrets file with the dockerconfigjson secret. Note that this file is in key=value format and string values are not quoted or escaped. The docker credentials secret is a json file in ~/.docker/config.json format.

SECRETA=xxxx
SECRETY=zzzz
dockerconfigjson={"auths": {"https://index.docker.io/v1/": {"auth": "c3R...zE2"}}}
2 Likes