使用 docker-image-resource 将 Concourse 未经授权的错误推送到 Artifactory
Concourse unauthorized error pushing to Artifactory using docker-image-resource
我正在尝试使用 Concourse 从 git 存储库中获取 docker 文件定义,做一些工作,构建 docker 图像,然后将新图像推送到神器。请参阅下面的管道定义。目前,我的所有阶段都在工作,直到 artifactory
阶段(推送到 Artifactory 的阶段)。 artifactory
阶段退出并出现以下输出错误:
waiting for docker to come up...
sha256:c6039bfb6ac572503c8d97f42b6a419b94139f37876ad331d03cb7c3e8811ff2
The push refers to repository [artifactory.server.com:2077/base/golang/alpine]
a4ab5bf94afd: Preparing
unauthorized: The client does not have permission to push to the repository.
这似乎是一个 Artifactory 权限问题,但我已经在本地使用 docker cli 进行了测试,并且能够使用 user/pass 中指定的相同 user/pass 进行推送15=] 和 destination_password
。我仔细检查了凭据以确保我使用的是相同的凭据并发现我是。
问题 #1:是否有其他已知原因导致此错误?我已经搜索了 resource github page 但没有找到任何东西。我可能会收到权限错误的任何想法?
在没有回答上述问题的情况下,我真的很想更深入地解决问题。为此,我使用 fly hijack
在相应的容器中获取 shell。我注意到 docker
安装在容器上,所以我认为下一步是在 tarball 上为我尝试推送的图像执行 docker import
,然后执行 docker push
将其推送到回购协议。尝试 运行 导入时出现错误:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is
the docker daemon running?
问题 #2:为什么我不能在容器内使用 docker 命令?也许这与我在 运行 管道时推动回购时看到的问题有关(我不这么认为)?是因为容器没有 运行 特权吗?我认为 privileged
参数将在资源类型定义中提供,但如果没有,我如何 运行 获得特权?
resources:
- name: image-repo
type: git
source:
branch: master
private_key: ((private_key))
uri: ssh://git@git-server/repo.git
- name: artifactory
type: docker-image
source:
repository: artifactory.server.com:2077/((repo))
tag: latest
username: ((destination_username))
password: ((destination_password))
jobs:
- name: update-image
plan:
- get: image-repo
- task: do-stuff
file: image-repo/scripts/do-stuff.yml
vars:
repository-directory: ((repo))
- task: build-image
privileged: true
file: image-repo/scripts/build-image.yml
- put: artifactory
params:
import_file: image/image.tar
哎呀。经过大量故障排除后发现 destination_password
由于特殊字符和缺少引号而未被正确拾取。通过在 --load-vars
标志包含的 yaml 文件中正确设置密码来解决此问题。
我正在尝试使用 Concourse 从 git 存储库中获取 docker 文件定义,做一些工作,构建 docker 图像,然后将新图像推送到神器。请参阅下面的管道定义。目前,我的所有阶段都在工作,直到 artifactory
阶段(推送到 Artifactory 的阶段)。 artifactory
阶段退出并出现以下输出错误:
waiting for docker to come up...
sha256:c6039bfb6ac572503c8d97f42b6a419b94139f37876ad331d03cb7c3e8811ff2
The push refers to repository [artifactory.server.com:2077/base/golang/alpine]
a4ab5bf94afd: Preparing
unauthorized: The client does not have permission to push to the repository.
这似乎是一个 Artifactory 权限问题,但我已经在本地使用 docker cli 进行了测试,并且能够使用 user/pass 中指定的相同 user/pass 进行推送15=] 和 destination_password
。我仔细检查了凭据以确保我使用的是相同的凭据并发现我是。
问题 #1:是否有其他已知原因导致此错误?我已经搜索了 resource github page 但没有找到任何东西。我可能会收到权限错误的任何想法?
在没有回答上述问题的情况下,我真的很想更深入地解决问题。为此,我使用 fly hijack
在相应的容器中获取 shell。我注意到 docker
安装在容器上,所以我认为下一步是在 tarball 上为我尝试推送的图像执行 docker import
,然后执行 docker push
将其推送到回购协议。尝试 运行 导入时出现错误:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
问题 #2:为什么我不能在容器内使用 docker 命令?也许这与我在 运行 管道时推动回购时看到的问题有关(我不这么认为)?是因为容器没有 运行 特权吗?我认为 privileged
参数将在资源类型定义中提供,但如果没有,我如何 运行 获得特权?
resources:
- name: image-repo
type: git
source:
branch: master
private_key: ((private_key))
uri: ssh://git@git-server/repo.git
- name: artifactory
type: docker-image
source:
repository: artifactory.server.com:2077/((repo))
tag: latest
username: ((destination_username))
password: ((destination_password))
jobs:
- name: update-image
plan:
- get: image-repo
- task: do-stuff
file: image-repo/scripts/do-stuff.yml
vars:
repository-directory: ((repo))
- task: build-image
privileged: true
file: image-repo/scripts/build-image.yml
- put: artifactory
params:
import_file: image/image.tar
哎呀。经过大量故障排除后发现 destination_password
由于特殊字符和缺少引号而未被正确拾取。通过在 --load-vars
标志包含的 yaml 文件中正确设置密码来解决此问题。