Hi, I’m trying to use the docker plugin to build/push an image to my own private registry. I have basic auth working on my registry and I can log in through the browser and see it. However, using the docker plugin with secrets (created the secrets in my drone.io repository), no matter how many times I try it won’t connect properly. Not sure what to do. I’ve tried reading other threads on this topic, but I’m sorta lost. Is the plugin documentation out of date, is the syntax I’m using wrong? Here’s my drone.yml:
name: default
steps:
- name: docker
image: myregistry/myimage
settings:
debug: true
username:
from_secret: registry_username
password:
from_secret: registry_password
repo: myregistry/myimage
tags: latest
when using a custom registry, you must use the fully qualified repository name and you must specify your registry hostname like this:
steps:
- name: docker
image: plugins/docker
settings:
username: kevinbacon
password: pa55word
+ repo: index.company.com/foo/bar
+ registry: index.company.com
If your registry does not use TLS also be sure to set insecure: true
It the above tips do not work, please post the full logs so that we can see the error message and advise further.
Cool, thanks.
I added the registry key with the FQDN of the registry and that didn’t seem to help. The registry is secured using TLS and it works when pushing from another machine no problem (docker login/docker push). The logs on the registry itself say there’s an invalid authorization credential which leads me to believe the secrets aren’t working or are somehow the wrong ones? I’ve tried deleting them and recreating them a bunch of times to make sure.
Log from the registry:
time="2019-06-19T17:40:53.638873822Z" level=warning msg="error authorizing context: basic authentication challenge for realm "Registry Realm": invalid authorization credential" go.version=go1.11.2 http.request.host=registry.jesseobrien.dev http.request.id=549fb99a-71cd-4909-824f-d607040e789d http.request.method=GET http.request.remoteaddr=192.34.61.196 http.request.uri="/v2/" http.request.useragent="docker/18.09.6 go/go1.10.8 git-commit/481bc77 kernel/4.15.0-47-generic os/linux arch/amd64 UpstreamClient(Go-http-client/1.1)"
Failure message:
can you please post your full yaml file? This error tells me that you are trying to use a private image in an image:
tag and you have not provided credentials. It do not believe it is related to your use of the docker plugin, which means the sample yaml you provided previously does not show us enough information to troubleshoot this further.
edit: your sample does show you are trying to use a private image (sorry, initially I thought you were using the plugins/docker image). When using a private image in your yaml, you need to give drone credentials to pull this image. See How to pull private images with 1.0
steps:
- name: docker
image: myregistry/myimage
You’re right. I don’t know why I had the image set to my own custom one. I reset it to plugin/docker
and it’s working now. oof.
Thanks so much for the help!