Not able to authenticate to a private registry

My drone version is 1.0.0-rc.4 run on my k8s cluster. I tried to build a docker image and push to a private registry,
got error “Error authenticating: exit status 1”.

However, in same cluster, it is ok to push to docker.io registry

Here is .drone.yml, I made a echo step to make sure the secret could be print

kind: pipeline
name: deploy

steps:
- name: echo
  image: docker
  environment:
    ALI_DOCKER_USERNAME:
      from_secret: ALI_DOCKER_USERNAME
    ALI_DOCKER_PASSWORD:
      from_secret: ALI_DOCKER_PASSWORD
  commands:
    - echo $ALI_DOCKER_USERNAME
    - echo $ALI_DOCKER_PASSWORD

- name: build-docker-image
  image: plugins/docker
  settings:
    repo: registry.cn-shanghai.aliyuncs.com/foo/bar
    registry: registry.cn-shanghai.aliyuncs.com
    username:
      from_secret: ALI_DOCKER_USERNAME
    password:
      from_secret: ALI_DOCKER_PASSWORD
    tag: latest
    dockerfile: ./Dockerfile
    debug: true
  when:
    branch: master

And here is the full log

+ /usr/local/bin/dockerd -g /var/lib/docker
time="2019-01-21T15:20:36Z" level=warning msg="The \"-g / --graph\" flag is deprecated. Please use \"--data-root\" instead"
time="2019-01-21T15:20:36.607961253Z" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
time="2019-01-21T15:20:36.608891761Z" level=info msg="libcontainerd: started new docker-containerd process" pid=17
time="2019-01-21T15:20:36Z" level=info msg="starting containerd" module=containerd revision=89623f28b87a6004d4b785663257362d1658a729 version=v1.0.0 
time="2019-01-21T15:20:36Z" level=info msg="setting subreaper..." module=containerd 
time="2019-01-21T15:20:36Z" level=info msg="changing OOM score to -500" module=containerd 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.content.v1.content"..." module=containerd type=io.containerd.content.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.btrfs"..." module=containerd type=io.containerd.snapshotter.v1 
time="2019-01-21T15:20:36Z" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.btrfs" error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" module=containerd 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.overlayfs"..." module=containerd type=io.containerd.snapshotter.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.metadata.v1.bolt"..." module=containerd type=io.containerd.metadata.v1 
time="2019-01-21T15:20:36Z" level=warning msg="could not use snapshotter btrfs in metadata plugin" error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" module="containerd/io.containerd.metadata.v1.bolt" 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.differ.v1.walking"..." module=containerd type=io.containerd.differ.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.gc.v1.scheduler"..." module=containerd type=io.containerd.gc.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.grpc.v1.containers"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.grpc.v1.content"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.grpc.v1.diff"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.grpc.v1.events"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.grpc.v1.healthcheck"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.grpc.v1.images"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.grpc.v1.leases"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.grpc.v1.namespaces"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.grpc.v1.snapshots"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.monitor.v1.cgroups"..." module=containerd type=io.containerd.monitor.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.runtime.v1.linux"..." module=containerd type=io.containerd.runtime.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.grpc.v1.tasks"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.grpc.v1.version"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T15:20:36Z" level=info msg="loading plugin "io.containerd.grpc.v1.introspection"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T15:20:36Z" level=info msg=serving... address="/var/run/docker/containerd/docker-containerd-debug.sock" module="containerd/debug" 
time="2019-01-21T15:20:36Z" level=info msg=serving... address="/var/run/docker/containerd/docker-containerd.sock" module="containerd/grpc" 
time="2019-01-21T15:20:36Z" level=info msg="containerd successfully booted in 0.018882s" module=containerd 
time="2019-01-21T15:20:36.719622490Z" level=info msg="Graph migration to content-addressability took 0.00 seconds"
time="2019-01-21T15:20:36.721610452Z" level=info msg="Loading containers: start."
time="2019-01-21T15:20:36.746977962Z" level=warning msg="Running modprobe bridge br_netfilter failed with message: ip: can't find device 'bridge'\nbridge                136173  1 br_netfilter\nstp                    12976  1 bridge\nllc                    14552  2 bridge,stp\nip: can't find device 'br_netfilter'\nbr_netfilter           22209  0 \nbridge                136173  1 br_netfilter\nmodprobe: can't change directory to '/lib/modules': No such file or directory\n, error: exit status 1"
time="2019-01-21T15:20:36.763102561Z" level=warning msg="Running modprobe nf_nat failed with message: `ip: can't find device 'nf_nat'\nnf_nat_masquerade_ipv4    13412  1 ipt_MASQUERADE\nnf_nat_ipv4            14115  1 iptable_nat\nnf_nat                 26787  3 xt_nat,nf_nat_masquerade_ipv4,nf_nat_ipv4\nnf_conntrack          133387  6 nf_nat_masquerade_ipv4,nf_conntrack_netlink,nf_conntrack_ipv4,nf_nat_ipv4,xt_conntrack,nf_nat\nlibcrc32c              12644  2 nf_nat,nf_conntrack\nmodprobe: can't change directory to '/lib/modules': No such file or directory`, error: exit status 1"
time="2019-01-21T15:20:36.776876092Z" level=warning msg="Running modprobe xt_conntrack failed with message: `ip: can't find device 'xt_conntrack'\nxt_conntrack           12760  5 \nnf_conntrack          133387  6 nf_nat_masquerade_ipv4,nf_conntrack_netlink,nf_conntrack_ipv4,nf_nat_ipv4,xt_conntrack,nf_nat\nmodprobe: can't change directory to '/lib/modules': No such file or directory`, error: exit status 1"
time="2019-01-21T15:20:36.876991449Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
time="2019-01-21T15:20:36.923933455Z" level=info msg="Loading containers: done."
time="2019-01-21T15:20:36.948635269Z" level=info msg="Docker daemon" commit=c97c6d6 graphdriver(s)=overlay2 version=17.12.0-ce
time="2019-01-21T15:20:36.948829667Z" level=info msg="Daemon has completed initialization"
time="2019-01-21T15:20:36.962584233Z" level=info msg="API listen on /var/run/docker.sock"
time="2019-01-21T15:20:38Z" level=fatal msg="Error authenticating: exit status 1"

I run another building process to push to docker.io,

kind: pipeline
name: deploy-staging

steps:
  - name: build-docker-image
    image: plugins/docker
    settings:
      repo:  allovince/yinxing.front
      username: allovince
      password:
        from_secret: DOCKER_PASSWORD
      tag: staging
      dockerfile: ./Dockerfile
      debug: true
    when:
      branch: master
      event: push

This works, here is the log

+ /usr/local/bin/dockerd -g /var/lib/docker
time="2019-01-21T13:51:08Z" level=warning msg="The \"-g / --graph\" flag is deprecated. Please use \"--data-root\" instead"
time="2019-01-21T13:51:08.156354315Z" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
time="2019-01-21T13:51:08.164966403Z" level=info msg="libcontainerd: started new docker-containerd process" pid=17
time="2019-01-21T13:51:08Z" level=info msg="starting containerd" module=containerd revision=89623f28b87a6004d4b785663257362d1658a729 version=v1.0.0 
time="2019-01-21T13:51:08Z" level=info msg="setting subreaper..." module=containerd 
time="2019-01-21T13:51:08Z" level=info msg="changing OOM score to -500" module=containerd 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.content.v1.content"..." module=containerd type=io.containerd.content.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.btrfs"..." module=containerd type=io.containerd.snapshotter.v1 
time="2019-01-21T13:51:08Z" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.btrfs" error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" module=containerd 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.overlayfs"..." module=containerd type=io.containerd.snapshotter.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.metadata.v1.bolt"..." module=containerd type=io.containerd.metadata.v1 
time="2019-01-21T13:51:08Z" level=warning msg="could not use snapshotter btrfs in metadata plugin" error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" module="containerd/io.containerd.metadata.v1.bolt" 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.differ.v1.walking"..." module=containerd type=io.containerd.differ.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.gc.v1.scheduler"..." module=containerd type=io.containerd.gc.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.grpc.v1.containers"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.grpc.v1.content"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.grpc.v1.diff"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.grpc.v1.events"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.grpc.v1.healthcheck"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.grpc.v1.images"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.grpc.v1.leases"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.grpc.v1.namespaces"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.grpc.v1.snapshots"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.monitor.v1.cgroups"..." module=containerd type=io.containerd.monitor.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.runtime.v1.linux"..." module=containerd type=io.containerd.runtime.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.grpc.v1.tasks"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.grpc.v1.version"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T13:51:08Z" level=info msg="loading plugin "io.containerd.grpc.v1.introspection"..." module=containerd type=io.containerd.grpc.v1 
time="2019-01-21T13:51:08Z" level=info msg=serving... address="/var/run/docker/containerd/docker-containerd-debug.sock" module="containerd/debug" 
time="2019-01-21T13:51:08Z" level=info msg=serving... address="/var/run/docker/containerd/docker-containerd.sock" module="containerd/grpc" 
time="2019-01-21T13:51:08Z" level=info msg="containerd successfully booted in 0.015852s" module=containerd 
time="2019-01-21T13:51:08.298488691Z" level=info msg="Graph migration to content-addressability took 0.00 seconds"
time="2019-01-21T13:51:08.299519204Z" level=info msg="Loading containers: start."
time="2019-01-21T13:51:08.319146212Z" level=warning msg="Running modprobe bridge br_netfilter failed with message: ip: can't find device 'bridge'\nbridge                136173  1 br_netfilter\nstp                    12976  1 bridge\nllc                    14552  2 bridge,stp\nip: can't find device 'br_netfilter'\nbr_netfilter           22209  0 \nbridge                136173  1 br_netfilter\nmodprobe: can't change directory to '/lib/modules': No such file or directory\n, error: exit status 1"
time="2019-01-21T13:51:08.331403441Z" level=warning msg="Running modprobe nf_nat failed with message: `ip: can't find device 'nf_nat'\nnf_nat_masquerade_ipv4    13412  1 ipt_MASQUERADE\nnf_nat_ipv4            14115  1 iptable_nat\nnf_nat                 26787  3 xt_nat,nf_nat_masquerade_ipv4,nf_nat_ipv4\nnf_conntrack          133387  6 nf_nat_masquerade_ipv4,nf_conntrack_netlink,nf_conntrack_ipv4,nf_nat_ipv4,xt_conntrack,nf_nat\nlibcrc32c              12644  2 nf_nat,nf_conntrack\nmodprobe: can't change directory to '/lib/modules': No such file or directory`, error: exit status 1"
time="2019-01-21T13:51:08.343437664Z" level=warning msg="Running modprobe xt_conntrack failed with message: `ip: can't find device 'xt_conntrack'\nxt_conntrack           12760  5 \nnf_conntrack          133387  6 nf_nat_masquerade_ipv4,nf_conntrack_netlink,nf_conntrack_ipv4,nf_nat_ipv4,xt_conntrack,nf_nat\nmodprobe: can't change directory to '/lib/modules': No such file or directory`, error: exit status 1"
time="2019-01-21T13:51:08.432664901Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
time="2019-01-21T13:51:08.491467072Z" level=info msg="Loading containers: done."
time="2019-01-21T13:51:08.506045385Z" level=info msg="Docker daemon" commit=c97c6d6 graphdriver(s)=overlay2 version=17.12.0-ce
time="2019-01-21T13:51:08.506301805Z" level=info msg="Daemon has completed initialization"
time="2019-01-21T13:51:08.544486946Z" level=info msg="API listen on /var/run/docker.sock"
+ /usr/local/bin/docker version
Client:
 Version:	17.12.0-ce
... skipped

Please confirm if it is a bug for private registry

Please confirm if it is a bug for private registry

Sorry I am unable to reproduce any issues with the Docker plugin using private registries. I tested with private registries at gcr and ecr. So at this time I cannot confirm any bugs with the Docker plugin.

If you continue to experience issues I recommend taking a look at the source, which is pretty simple: GitHub - drone-plugins/drone-docker: Drone plugin for publishing Docker images

It is a little weird issue, I re-reployed drone server/agent, it fixed, now I could not make it happen again