本地无法访问Gitlab CI docker映像

时间:2019-06-01 11:14:38

标签: spring-boot docker gitlab-ci docker-image

新推送完成后,ci会通过,但当我尝试访问本地的docker构建时,不会这样做

sudo docker pull registry.gitlab.com/thomson-aequalis/springboot-docker-k8-gitci

执行上述命令时出现在本地的错误 Error response from daemon: Get https://registry.gitlab.com/v2/thomson-aequalis/springboot-docker-k8-gitci/manifests/latest: denied: access forbidden

.gitlab-ci.yml

    image: docker:latest
services:
    - docker:dind

variables:
    DOCKER_DRIVER: overlay
    SPRING_PROFILES_ACTIVE: gitlab-ci

stages:
    - build
    - package
    - deploy

maven-build:
    image: maven:3-jdk-8
    stage: build
    script: "mvn package -B"
    artifacts:
        paths:
            - target/*.jar

docker-build:
    stage: package
    script:
        - docker build -t registry.gitlab.com/thomson-aequalis/springboot-docker-k8-gitci .
        - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
        - docker push registry.gitlab.com/thomson-aequalis/springboot-docker-k8-gitci

enter image description here

1 个答案:

答案 0 :(得分:0)

在您的Gitlab-CI作业中,登录到注册表。从注册表中拉出之前,应该在本地执行相同操作,但要使用自己的Gitlab用户名。