Build fails when using auto_tag in Docker plugin

Hi there,

I’m getting the following error when trying to use the Docker plugin with “auto_tag” set to true:

  • /usr/local/bin/docker tag c36b6249e21c3aacd091f1f76f6f000d47837904 :latest
    Error parsing reference: “:latest” is not a valid repository/tag: invalid reference format

Looks like there is an extra colon being appended to the tag name?

@vshulev please help us help you buy posting a full example of your yaml configuration file. It looks like you are missing the repo attribute, however, we would need to see your configuration to properly diagnose.

Hi @bradrydzewski,
Thanks for the amazingly quick response! Yes, the issue was that I was missing the repo attribute. It’s all working out now :slight_smile: Thanks, for the help!

Hi there.
I’m having the same problem, but I’ve had the repo attribute filled from the start.

Here’s my conf:

 docker-build:
    image: plugins/docker
    settings:
      username:
        from_secret: docker-user
      password:
        from_secret: docker-password
      repo: my.docker-registry.com/my-app/server
      registry: my.docker-registry.com
      tags: latest

My step output:

Successfully built a03c5ce51dd3
Successfully tagged 0bc3414d19f1e423e12c7c5c111c9156689e67b8:latest
+ /usr/local/bin/docker tag 0bc3414d19f1e423e12c7c5c111c9156689e67b8 :latest
Error parsing reference: ":latest" is not a valid repository/tag: invalid reference format

@Skogsfrae your configuration is invalid. The yaml syntax in your example is a mixture of 0.8 and 1.0, and therefore will fail in both versions of Drone.

1 Like

@bradrydzewski thanks a lot for your quick answer!
Is a doc of docker plugin syntax for 0.8 still available or should I update to 1.0 in order to use it?

Found this if someone else is going to need it https://github.com/drone/drone-plugin-index/blob/2feceac8f3be03b706a2515c089eac290aba95b7/content/drone-plugins/drone-docker/index.md

I have the following configuration

kind: pipeline
type: docker
name: default

steps:
- name: backend
  image: golang
  commands:
  - go build
  - go test

- name: docker
  image: plugins/docker
  repo: vivek125/simplego
  registry: docker.io
  username:
    from_secret: docker_username
  password:
    from_secret: docker_password
  auto_tag: true
  when:
    branch: master

and the repo is not used in the tag
Successfully built 6da4610ad6be
111 Successfully tagged 39d097259173f9fb3945e1d3b2fd8cb99b81b1dc:latest
112 + /usr/local/bin/docker tag 39d097259173f9fb3945e1d3b2fd8cb99b81b1dc :latest
113 Error parsing reference: “:latest” is not a valid repository/tag: invalid reference format

All plugin configuration parameters need to go under the settings section which is missing from your configuration. See the plugin docs for some example configurations.

1 Like