无法在无人机docker build上标记图像:解析引用错误:“:latest”不是有效的存储库/标签:无效的引用格式

时间:2018-12-29 10:40:25

标签: docker drone

我正在尝试在gitlab中使用无人机。在将Docker映像推送到我的私有注册表的步骤之前,它会引发错误:

Successfully built 7afb99118ae2
Successfully tagged ae872a846df0d8df884e89bd3a77cacf49b8f7de:latest
+ /usr/local/bin/docker tag ae872a846df0d8df884e89bd3a77cacf49b8f7de :latest
Error parsing reference: ":latest" is not a valid repository/tag: invalid reference format

我的无人机是无人机/无人驾驶飞机:1.0.0-rc.3

这是我的.drone.yml文件

kind: pipeline
name: default

steps:
- name: build
  image: python:3.6
  commands:
  - pip install -r requirements.txt
  - python -m pytest app.py
  when:
    branch:
    - master
    event:
    - push
    - pull_request

- name: publish
  image: plugins/docker
  registry: registry.cn-beijing.aliyuncs.com
  repo: registry.cn-beijing.aliyuncs.com/xxx/xxx
  tags: latest
  username: 
  - from_secret: ali_username
  password:
  - from_secret: ali_password

还有我的Dockerfile

FROM python:3.6-alpine
RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone
COPY requirements.txt /requirements.txt
RUN pip install -r /requirements.txt
ADD . /code
WORKDIR /code
CMD ["python", "app.py"]

我已经尝试过这些:

tags: latest
tags: 1
tags: [1, 1.1]
tags: [1, 1.1, latest]
tags:
  - latest

甚至删除tags行,但没有任何效果。

这是怎么了?谢谢你的提示!

1 个答案:

答案 0 :(得分:0)

您的yml文件中的某个地方tag value设置为空,但是docker tag命令中有:

查看图片以产生上述错误。

enter image description here

我没有使用drone.io,但是您的yml文件中存在缩进或配置问题,设置下的标签也是如此,

kind: pipeline
name: default

steps:
- name: docker  
  image: plugins/docker
  settings:
    username: kevinbacon
    password: pa55word
    repo: foo/bar
    tags: latest

http://plugins.drone.io/drone-plugins/drone-docker/