Error authenticating: exit status 1

I know this a very common issue but I’ve spent hours trying to make it work and I’m seriously running out of ideas.

Running the following docker login in a terminal works:

$ docker login rg.nl-ams.scw.cloud -u nologin
Password: secret

However the Drone job does not. Here is my .drone-ci.yaml file:

kind: pipeline
name: default
steps:

  - name: build
    image: plugins/docker
    settings:
      privileged: true
      debug: true
      registry: "rg.nl-ams.scw.cloud"
      repo: "registry-prd-1538c1t4/website"
      userame: nologin
      password: secret
      tags:
        - dev

trigger:
  branch:
  - master

node:
  pool: docker-dev
  agent: docker
  environment: dev

Full debug output:

latest: Pulling from plugins/docker
Digest: sha256:014a753cb3c1178df355a6ce97c4bf1d1860802f41ed5ae07493ff8a74660d0f
Status: Image is up to date for plugins/docker:latest
+ /usr/local/bin/dockerd --data-root /var/lib/docker --host=unix:///var/run/docker.sock
time="2020-08-02T20:35:26.870611639Z" level=info msg="Starting up"
time="2020-08-02T20:35:26.871833800Z" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
time="2020-08-02T20:35:26.872686067Z" level=info msg="libcontainerd: started new containerd process" pid=25
time="2020-08-02T20:35:26.872919944Z" level=info msg="parsed scheme: \"unix\"" module=grpc
time="2020-08-02T20:35:26.873139010Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
time="2020-08-02T20:35:26.873365397Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}] <nil>}" module=grpc
time="2020-08-02T20:35:26.873571536Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
time="2020-08-02T20:35:26.886276224Z" level=info msg="starting containerd" revision=7ad184331fa3e55e52b890ea95e65ba581ae3429 version=v1.2.13 
time="2020-08-02T20:35:26.887002443Z" level=info msg="loading plugin "io.containerd.content.v1.content"..." type=io.containerd.content.v1 
time="2020-08-02T20:35:26.887278249Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.btrfs"..." type=io.containerd.snapshotter.v1 
time="2020-08-02T20:35:26.887657599Z" 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" 
time="2020-08-02T20:35:26.887861013Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.aufs"..." type=io.containerd.snapshotter.v1 
time="2020-08-02T20:35:26.893618313Z" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.aufs" error="modprobe aufs failed: "ip: can't find device 'aufs'\naufs                  274432  0 \nmodprobe: can't change directory to '/lib/modules': No such file or directory\n": exit status 1" 
time="2020-08-02T20:35:26.893971204Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.native"..." type=io.containerd.snapshotter.v1 
time="2020-08-02T20:35:26.894274117Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.overlayfs"..." type=io.containerd.snapshotter.v1 
time="2020-08-02T20:35:26.894652435Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.zfs"..." type=io.containerd.snapshotter.v1 
time="2020-08-02T20:35:26.895028190Z" level=info msg="skip loading plugin "io.containerd.snapshotter.v1.zfs"..." type=io.containerd.snapshotter.v1 
time="2020-08-02T20:35:26.895231692Z" level=info msg="loading plugin "io.containerd.metadata.v1.bolt"..." type=io.containerd.metadata.v1 
time="2020-08-02T20:35:26.895524532Z" 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" 
time="2020-08-02T20:35:26.895731930Z" level=warning msg="could not use snapshotter aufs in metadata plugin" error="modprobe aufs failed: "ip: can't find device 'aufs'\naufs                  274432  0 \nmodprobe: can't change directory to '/lib/modules': No such file or directory\n": exit status 1" 
time="2020-08-02T20:35:26.895936412Z" level=warning msg="could not use snapshotter zfs in metadata plugin" error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter: skip plugin" 
time="2020-08-02T20:35:26.905581302Z" level=info msg="loading plugin "io.containerd.differ.v1.walking"..." type=io.containerd.differ.v1 
time="2020-08-02T20:35:26.905889772Z" level=info msg="loading plugin "io.containerd.gc.v1.scheduler"..." type=io.containerd.gc.v1 
time="2020-08-02T20:35:26.906152838Z" level=info msg="loading plugin "io.containerd.service.v1.containers-service"..." type=io.containerd.service.v1 
time="2020-08-02T20:35:26.906403803Z" level=info msg="loading plugin "io.containerd.service.v1.content-service"..." type=io.containerd.service.v1 
time="2020-08-02T20:35:26.906623101Z" level=info msg="loading plugin "io.containerd.service.v1.diff-service"..." type=io.containerd.service.v1 
time="2020-08-02T20:35:26.906814366Z" level=info msg="loading plugin "io.containerd.service.v1.images-service"..." type=io.containerd.service.v1 
time="2020-08-02T20:35:26.907019922Z" level=info msg="loading plugin "io.containerd.service.v1.leases-service"..." type=io.containerd.service.v1 
time="2020-08-02T20:35:26.907229794Z" level=info msg="loading plugin "io.containerd.service.v1.namespaces-service"..." type=io.containerd.service.v1 
time="2020-08-02T20:35:26.907456384Z" level=info msg="loading plugin "io.containerd.service.v1.snapshots-service"..." type=io.containerd.service.v1 
time="2020-08-02T20:35:26.907663856Z" level=info msg="loading plugin "io.containerd.runtime.v1.linux"..." type=io.containerd.runtime.v1 
time="2020-08-02T20:35:26.908009582Z" level=info msg="loading plugin "io.containerd.runtime.v2.task"..." type=io.containerd.runtime.v2 
time="2020-08-02T20:35:26.908319961Z" level=info msg="loading plugin "io.containerd.monitor.v1.cgroups"..." type=io.containerd.monitor.v1 
time="2020-08-02T20:35:26.908836506Z" level=info msg="loading plugin "io.containerd.service.v1.tasks-service"..." type=io.containerd.service.v1 
time="2020-08-02T20:35:26.909063745Z" level=info msg="loading plugin "io.containerd.internal.v1.restart"..." type=io.containerd.internal.v1 
time="2020-08-02T20:35:26.909322526Z" level=info msg="loading plugin "io.containerd.grpc.v1.containers"..." type=io.containerd.grpc.v1 
time="2020-08-02T20:35:26.909542830Z" level=info msg="loading plugin "io.containerd.grpc.v1.content"..." type=io.containerd.grpc.v1 
time="2020-08-02T20:35:26.909744724Z" level=info msg="loading plugin "io.containerd.grpc.v1.diff"..." type=io.containerd.grpc.v1 
time="2020-08-02T20:35:26.909948467Z" level=info msg="loading plugin "io.containerd.grpc.v1.events"..." type=io.containerd.grpc.v1 
time="2020-08-02T20:35:26.910147861Z" level=info msg="loading plugin "io.containerd.grpc.v1.healthcheck"..." type=io.containerd.grpc.v1 
time="2020-08-02T20:35:26.910379342Z" level=info msg="loading plugin "io.containerd.grpc.v1.images"..." type=io.containerd.grpc.v1 
time="2020-08-02T20:35:26.910593568Z" level=info msg="loading plugin "io.containerd.grpc.v1.leases"..." type=io.containerd.grpc.v1 
time="2020-08-02T20:35:26.910801664Z" level=info msg="loading plugin "io.containerd.grpc.v1.namespaces"..." type=io.containerd.grpc.v1 
time="2020-08-02T20:35:26.911003536Z" level=info msg="loading plugin "io.containerd.internal.v1.opt"..." type=io.containerd.internal.v1 
time="2020-08-02T20:35:26.911418870Z" level=info msg="loading plugin "io.containerd.grpc.v1.snapshots"..." type=io.containerd.grpc.v1 
time="2020-08-02T20:35:26.911609782Z" level=info msg="loading plugin "io.containerd.grpc.v1.tasks"..." type=io.containerd.grpc.v1 
time="2020-08-02T20:35:26.911816264Z" level=info msg="loading plugin "io.containerd.grpc.v1.version"..." type=io.containerd.grpc.v1 
time="2020-08-02T20:35:26.912015292Z" level=info msg="loading plugin "io.containerd.grpc.v1.introspection"..." type=io.containerd.grpc.v1 
time="2020-08-02T20:35:26.912439189Z" level=info msg=serving... address="/var/run/docker/containerd/containerd-debug.sock" 
time="2020-08-02T20:35:26.912696910Z" level=info msg=serving... address="/var/run/docker/containerd/containerd.sock" 
time="2020-08-02T20:35:26.912897028Z" level=info msg="containerd successfully booted in 0.027071s" 
time="2020-08-02T20:35:26.920250865Z" level=info msg="parsed scheme: \"unix\"" module=grpc
time="2020-08-02T20:35:26.920635105Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
time="2020-08-02T20:35:26.920880513Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}] <nil>}" module=grpc
time="2020-08-02T20:35:26.921103525Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
time="2020-08-02T20:35:26.929198788Z" level=info msg="parsed scheme: \"unix\"" module=grpc
time="2020-08-02T20:35:26.929581383Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
time="2020-08-02T20:35:26.929808499Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}] <nil>}" module=grpc
time="2020-08-02T20:35:26.930014972Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
time="2020-08-02T20:35:26.970439144Z" level=warning msg="Your kernel does not support swap memory limit"
time="2020-08-02T20:35:26.970807403Z" level=warning msg="Your kernel does not support cgroup rt period"
time="2020-08-02T20:35:26.971024482Z" level=warning msg="Your kernel does not support cgroup rt runtime"
time="2020-08-02T20:35:26.971455430Z" level=info msg="Loading containers: start."
time="2020-08-02T20:35:26.980848478Z" level=warning msg="Running modprobe bridge br_netfilter failed with message: ip: can't find device 'bridge'\nbridge                188416  1 br_netfilter\nstp                    16384  1 bridge\nllc                    16384  2 bridge,stp\nip: can't find device 'br_netfilter'\nbr_netfilter           24576  0 \nbridge                188416  1 br_netfilter\nmodprobe: can't change directory to '/lib/modules': No such file or directory\n, error: exit status 1"
time="2020-08-02T20:35:27.044119251Z" 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="2020-08-02T20:35:27.081689617Z" level=info msg="Loading containers: done."
time="2020-08-02T20:35:27.091598959Z" level=info msg="Docker daemon" commit=afacb8b7f0 graphdriver(s)=overlay2 version=19.03.8
time="2020-08-02T20:35:27.092083486Z" level=info msg="Daemon has completed initialization"
time="2020-08-02T20:35:27.130463430Z" level=info msg="API listen on /var/run/docker.sock"
time="2020-08-02T20:35:27Z" level=fatal msg="Error authenticating: exit status 1"

I’m pretty sure it’s not a problem with the registry credentials, because I used tcpdump and there is not a single packet sent to the registry.

the logs demonstrate that the docker daemon starts correctly and is listening on the socket (all the other noise in the logs are common). If a docker login inside of the container fails and you do not see any network packets reach the registry, perhaps it would point to a DNS issue or networking issue? DNS issues are not unheard of when using docker-in-docker, especially considering that each Drone pipeline is attached to a user-defined network as opposed to the default bridge network. Have you tried any of the plugins DNS settings, such as custom_dns? Also not sure what version of Drone you are using or which runner you have installed (e.g. kubernetes vs docker) which would also impact how one might debug this issue.

Lastly, I do see one other (unrelated) issue with the configuration. Once you resolve the login, please also make sure to update your repository name to use the fully qualified image name:

    settings:
      privileged: true
      debug: true
      registry: "rg.nl-ams.scw.cloud"
-     repo: "registry-prd-1538c1t4/website"
+     repo: "rg.nl-ams.scw.cloud/registry-prd-1538c1t4/website"