Pushing to private registry fails

I get an authentication error when I am pushing to a private docker registry. Pulling on the other hand works as expected. Sample .drone.yml that highlights the issue:

        image: private.registry/image
            - echo "Pull Ok"

        image: plugins/docker
        repo: image
        registry: private.registry
        username: admin
        password: password
        tags: latest
        dockerfile: Dockerfile

The output I am getting when I am running drone exec --local is the following:

+ echo "Pull Ok"
Pull Ok
+ /usr/local/bin/dockerd -g /var/lib/docker
time="2017-09-15T14:26:36Z" level=fatal msg="Error authenticating: exit status 1"
2017/09/15 17:26:38 drone_step_2 : exit code 1

The user credentials are correct, pushing directly to the private regisrtry works without issues:

docker push private.registry/image

I managed to track down the issue. There were two problems.

  • The authentication was failing due to the certificate. I bypassed it by adding the insecure: true option. The error message was straight forward when debugging was enabled (x509: certificate signed by unknown authority). If this error appeared even with debugging disabled it would have saved me a couple of hours.
  • The repo should contain the registry so in front of image it should be private.registry/image

In order to track down the cause of the error I had to enable debugging in the push step: