Registry credentials not provided. Guest mode enabled? [solved]

I am having troubling passing credentials for docker hub so that I can push the built image.

Anyone have any ideas? I have tried hard encoding username: blah and password: blah into the drone.yml and this doesn’t work. I have also tried using docker_username and docker_password which is what the plugins/docker is expecting and still doesn’t want to play ball.

I also can confirm the secrets are present with:

$ drone secret ls example/docker-project
docker_username
Events: push, tag, deployment
Images: plugins/docker

docker_password
Events: push, tag, deployment
Images: plugins/docker

So what gives? why is it not detecting any creds?

I have also added it to the reg section under the repo and it still doesn’t like it. I am trying to push to docker.io.

I have tried several variants but still no success, the latest configs for .drone.yml can be seen below.

pipeline:
  docker:
    image: plugins/docker
    repo: example/project
    action: build
    tags: latest

publish:
  docker:
    repo: example/project
    secrets: [ docker_username, docker_password ]
    when:
branch: master

Also tried:

pipeline:
  docker:
    image: plugins/docker
    repo: example/project
    action: build
    tags: latest

publish:
  docker:
    repo: example/project
    username: myuser
    password: mypass
    when:
branch: master

Can anyone spot what I am doing wrong? I would be extremely grateful if anyone could point out why this is failing. Worst case I could probably do manual docker commands to do it via script but would prefer to use the provided drone official plugin.

I am also running drone 0.8.2 which afaik is the latest stable/official release.

Regards,

Majestic

I have tried several variants but still no success […] So what gives? why is it not detecting any creds?

None of the variants in your post use the correct syntax. The below example demonstrates the correct yaml syntax for using the docker plugin:

pipeline:
  docker:
    image: plugins/docker
    repo: octocat/hello-world
    tags: latest
    secrets: [ docker_username, docker_password ]

For more details, see http://plugins.drone.io/drone-plugins/drone-docker/

Thank you.

I have tried many different configs/changes but these were the only ones I still had lying around.

The only thing I can see which is different is the tags: line but in all honestly latest should be automatically used so I cant see how this will help. Never the less I will give it a shot shortly and let you know. Thanks for the info.

The error message is quite clear that its not getting the credentials to upload the repo. This you can see at the top of the logs.

Thanks @bradrydzewski. It seems the secrets line was in the wrong place. Silly me.

I can confirm the below config is now correct/working as expected. Thanks again.

pipeline:
  docker:
    secrets: [ docker_username, docker_password ]
    image: plugins/docker
    repo: example/project
    action: build
    tags: latest

publish:
  docker:
    repo: docker.io/example/project
    registry: docker.io   
    when:
branch: master

The publish section of the above yaml does not do anything, and can be removed

pipeline:
  docker:
    secrets: [ docker_username, docker_password ]
    image: plugins/docker
    repo: example/project
    action: build
    tags: latest

-publish:
-  docker:
-    repo: docker.io/example/project
-    registry: docker.io   
-    when:
-branch: master

Hi

I am facing the same thing… im trying to build and push an arm image. The build is successful but fails on pushing

at the top of the logs i can see

Registry credentials not provided. Guest mode enabled.

and then when it gets to pushing

denied: requested access to the resource is denied

my .drone.yml is

platform: linux/arm
pipeline:
  docker:
    secrets: [ docker_username, docker_password ]
    image: plugins/docker:linux-arm
    repo: jcowey/dnsmasq-arm
    action: build
    tags: latest

my secrets list is

$ drone secret ls jack/docker-dnsmasq-arm
docker_password
Events: push, tag, deployment
SkipVerify: false
Conceal: false

docker_username
Events: push, tag, deployment
SkipVerify: false
Conceal: false

Im using latest docker tags for drone server and agents.
I have configured docker.io registry creds via the web ui

I over came my issue by starting again :smiley:

here is my working yml

platform: linux/arm
pipeline:
  docker:
    image: plugins/docker:linux-arm
    action: build
    repo: jcowey/dnsmasq-arm
    secrets: [ docker_username, docker_password ]
    auto_tag: true
publish:
  docker:
    repo: docker.io/jcowey/dnsmasq-arm
    registry: docker.io
    when:
      branch: master

Thank you very much, this is working great now. The only thing I would like to ask is, what if the git repo is different than the final docker registry?

i.e. github repo url/name: majestic/project1 but the docker hub is say bob/project1 or even a totally different project name?

How would one do this? any tips?

The only thing I would like to ask is, what if the git repo is different than the final docker registry?

The docker plugin does not use the git repository name in any way, so the fact that your git repository name does not match your docker repository name is not a problem.

In fact, nearly every image I publish uses a different registry name. See for example github.com/drone-plugins/drone-slack which publishes to plugins/slack in dockerhub:

Thats awesome, thank you for clearing that up.

Again awesome project, so much easier then Jenkins :slight_smile: