如何在gitlab-ci作业中提取私人图片

时间:2018-10-29 12:15:16

标签: docker gitlab-ci gitlab-ci-runner

这是我的gitlab-ci工作。

build:master-deploy:
  image: test/base:latest
  stage: build
  script:
    - mvn clean install -DAPPEND_TO_BUILD-NAME=-${CI_PIPELINE_ID}
    - export AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID_SYSTEST}
    - export AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY_SYSTEST}
    - echo CodePipeLine Build ID - $CI_JOB_ID
    - echo CodePipeLine PipleLine ID - $CI_PIPELINE_ID
    - echo Following Build will be uploaded to S3 Build  ${BUILD_TARGET_FOLDER}/${TARGET_BUILD_NAME}
    - cd ${BUILD_TARGET_FOLDER}
    - echo $(ls)
    - aws s3api put-object --bucket ${S3_BUCKET_NAME} --region us-east-1 --key systest/${TARGET_BUILD_NAME} --body ${TARGET_BUILD_NAME} --tagging GitLabJOBNumber=$CI_JOB_ID
  tags: 
    - docker
  only:
    - master

test / base:latest 是一个私人图片,这就是我得到的原因

错误:作业失败:来自守护程序的错误响应:找不到存储库测试/库:不存在或没有拉取权限。

我尝试过

before_script:
  - docker info
  - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD

如何解决该错误?

0 个答案:

没有答案