Build step error in private registry using plugins/docker (Error authenticating: exit status 1)

Hi,

Got error “Error authenticating: exit status 1” when drone gets to the build step with plugins/docker.

The registry accout and password is correct but somehow shows “Error authenticating”.

Drone image:

REPOSITORY TAG IMAGE ID CREATED SIZE
drone/drone 1 c0d51d5b4655 6 weeks ago 67.6MB
drone/drone-runner-docker 1 4383cdc064cc 6 weeks ago 20.6MB

.drone.yml

- name: build
  image: plugins/docker
  settings:
    insecure: true
    dockerfile: Dockerfile
    username:
      from_secret: account
    password:
      from_secret: registry_password
    repo: registry.local:5000/test
    registry: registry.local:5000

Error message:

default — build 00:59
1 latest: Pulling from plugins/docker
2 Digest: sha256:1d4743c50cfe06e84962a45337dc7ac200982c00c98d67852b54bf9475d37358
3 Status: Image is up to date for plugins/docker:latest
4 + /usr/local/bin/dockerd --data-root /var/lib/docker --insecure-registry registry.local:5000
5 time=“2020-03-16T07:48:10Z” level=fatal msg=“Error authenticating: exit status 1

Environment


Some environment info may help:

registry.local:5000 is my private registry,
DNSmasq config of internal doamin:
address=/registry.local/172.28.0.2

Docker registry’s
docker-compose.yml

registry:
    image: docker.io/registry:2
    ports:
      - "1234:5000"
    networks:
      default:
        ipv4_address: 172.28.0.2

Drone sever/runner, registry and DNSmasq containers are all in the same network.

But it works when I use a public domain like https://registry.xxxx.com, somehow failed with internal domain.

And it is fine when drone pulls image from my private registry in pipeline steps.
e.g.

- name: install
  image: registry.local:5000/node
  commands:
    - npm install

image_pull_secrets:
- dockerconfig

I tried ‘custom_dns:172.28.0.3(DNSmasq container ip)’ option of plugins/docker, not working…

Would you please help? Thanks!

All steps are attached to a per-pipeline network (e.g. docker network create $RANDOM). This network is unique for each pipeline. This means your pipeline steps are not on the same network as your server / runner / registry.

If you would like to attach your pipeline steps to additional networks, you need to use the DRONE_RUNNER_NETWORKS runner setting. I also recommend searching this forum to learn more about this setting, since it is discussed in many threads.

1 Like

That makes perfect sense and it works now, Thank you! :smile: