Plugins/docker for private registry

kind: pipeline
name: default

steps:
- name: publish
  image: plugins/docker
  settings:
    registry: registry.haitanyule.com
    repo: b3log/pipe
    username:
      from_secret: REGISTRY_USER
    password:
      from_secret: REGISTRY_PASSWORD
    tags:
      - 1.8.4
      - latest
#      - ${DRONE_TAG}
#  when:
#    event:
#      - tag

error logs

+ /usr/local/bin/docker push b3log/pipe:1.8.4
The push refers to repository [docker.io/b3log/pipe]
981860bd379f: Preparing
eba4ef1e7bcb: Preparing
ebf12965380b: Preparing
denied: requested access to the resource is denied
time="2018-12-14T16:33:59Z" level=fatal msg="exit status 1"

one thing that jumps out is that you need to use the fully qualified repo name, otherwise your image is tagged as b3log/pipe instead of registry.haitanyule.com/b3log/pipe, in which case the docker daemon tries to push to dockerhub (where the credentials fail)

registry: registry.haitanyule.com
-repo: b3log/pipe
+repo: registry.haitanyule.com/b3log/pipe

but i have declare the registry

registry: registry.haitanyule.com

You still need to declare the fully qualified repo name and the registry separate. One is for tagging/pushing, the other is for getting credentials.

我觉得定义一个就好了。重复定义容易让人迷惑,而且用起来不是很舒适。
— translate —
I think it’s good to define one. Repeated definitions are confusing and uncomfortable to use.

Ok, just to be pretty sure, because I’m still getting errors saying that I need to make docker login…

I want one step of my pipeline to run on

registry.gitlab.com/semantix/default-follower:develop

So, this becomes in .drone.yml:

- name: Build EC2 instance
  image: default-follower
  settings:
    registry: registry gitlab com (omitted dots to make discourse happy)
    repo: registry.gitlab.com/semantix
    username:
      from_secret: REGISTRY_USER
    password:
      from_secret: REGISTRY_PASSWORD
    tags:
      - develop

Am I missing something?

Thanks

This thread is specific to the docker plugin … image: plugins/docker … your example does not use the docker plugin, so I do not think this thread is relevant.

If the goal is to pull private images for use in your build step see How to pull private images with 1.0