I am trying to push a docker image into a private registry in Drone 0.8.5 and it works when I hardcode username and password into the pipeline however I have tried adding both the registry details in the registry tab and as secrets.
Registry Pipeline
docker-registry-push:
image: plugins/docker
repo: registry.domain.com:5000/app
registry: registry.domain.com:5000
insecure: true
pull: true
Fails with no basic auth credentials
Finally I've tried variable substitution. (with $REGISTRY_USERNAME and $$REGISTRY_USERNAME variables. All result in a error msg="Error authenticating: exit status 1"
docker-registry-push:
image: plugins/docker
repo: registry.domain.com:5000/app
registry: registry.domain.com:5000
secrets:
- source: registry_username
target: username
- source: registry_password
target: password
insecure: true
pull: true
another attempt
docker-registry-push:
image: plugins/docker
repo: registry.domain.com:5000/app
registry: registry.domain.com:5000
username: ${REGISTRY_USERNAME}
password: ${REGISTRY_PASSWORD}
secrets: [ registry_username, registry_password ]
insecure: true
pull: true
It is really frustrating. I need to add secrets for Rancher accesskey secretkey also after this via the correct method.
I have read other topics and the drone docs and am still stumped.
Thanks in advance.
The secrets need to be injected into the docker container via the environment with the names docker_username
and and docker_password
.
Your .drone.yml
file should look something like this:
pipeline:
docker:
image: plugins/docker
repo: username/app
registry: registry.domain.com:5000
insecure: true
pull: true
secrets:
- source: registry_username
target: docker_username
- source: registry_password
target: docker_password
See the drone plugin docs for more configuration options.