我正在尝试将Docker镜像推送到Drone 0.8.5中的私有注册表,当我将用户名和密码硬编码到管道中时,它可以正常工作,但我尝试在注册表选项卡中添加注册表详细信息并作为机密。
注册表管道
docker-registry-push:
image: plugins/docker
repo: registry.domain.com:5000/app
registry: registry.domain.com:5000
insecure: true
pull: true
与no basic auth credentials
失败
最后我尝试了变量替换。 (使用$ REGISTRY_USERNAME和$$ REGISTRY_USERNAME变量。所有都会导致错误msg="Error authenticating: exit status 1"
docker-registry-push:
image: plugins/docker
repo: registry.domain.com:5000/app
registry: registry.domain.com:5000
secrets:
- source: registry_username
target: username
- source: registry_password
target: password
insecure: true
pull: true
另一次尝试
docker-registry-push:
image: plugins/docker
repo: registry.domain.com:5000/app
registry: registry.domain.com:5000
username: ${REGISTRY_USERNAME}
password: ${REGISTRY_PASSWORD}
secrets: [ registry_username, registry_password ]
insecure: true
pull: true
真的很令人沮丧。我需要通过正确的方法为Rancher accesskey secretkey添加秘密。
我已经阅读了其他主题和无人机文档,我仍然感到难过。
提前致谢。
秘密需要通过名为docker_username
和docker_password
的环境注入docker容器。
您的.drone.yml
文件应如下所示:
pipeline:
docker:
image: plugins/docker
repo: username/app
registry: registry.domain.com:5000
insecure: true
pull: true
secrets:
- source: registry_username
target: docker_username
- source: registry_password
target: docker_password
有关更多配置选项,请参阅drone plugin docs。
这里是管理无人机秘密密钥http://docs.drone.io/manage-secrets/#pull-requests
另外,你可能想考虑在你的构建中使用.netrc
中的Dockerfile
,所以你的凭证被嵌入你的docker图像中