Docker Community Forums

Share and learn in the Docker community.

Gitlab-ci docker problem

Hi people I’m having a problem with my ci/cd in gitlab at the time of deploying the log below:

and the funny thing is that the build rolls normally

segue meu gitlab-ci:

# PROD
build to prod:
  stage: build
  script:
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
    - docker build . -f docker/Dockerfile --build-arg DEPLOY=prod -t $RELEASE_IMAGE
    - docker push $RELEASE_IMAGE
  only:
    - /master/
  environment: prod
  tags:
    - docker

before_script:
  -   docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY

deploy to prod:
  stage: deploy
  image: $RELEASE_IMAGE
  before_script:
  -   docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
  script:
    - "DEPLOY_FILE=$(ls /opt/jboss/wildfly/standalone/deployments/ | grep .war | head -1)"
    - echo "Realizando o deploy de $DEPLOY_FILE..."echo "Realizando o deploy de $DEPLOY_FILE..."
    - /opt/jboss/wildfly/bin/jboss-cli.sh --connect --controller=$HOST_WILDFLY --user=$USER_WILDFLY --password=$PW_WILDFLY --timeout=60000 --commands="deploy /opt/jboss/wildfly/standalone/deployments/"$DEPLOY_FILE" --force"
  only:
    - /master/
  environment: prod
  tags:
    - docker

I did it with the before_script tag and without it and it’s the same

I edited your last post. Please, use the </> button to highlight the selected code so it won’t be interpreted as MarkDown and we can understand the question better.

Also try to edit your post instead of posting again in such a short period of time. If you post multiple times without getting an answer, it will look like you have got answers

I haven’t used Gitlab CI yet so I can’t how the yml file should look like, but does that registry in the error message exist? Where did you defined that? I tried to access it from a webbrowser but I couldn’t.

Are you sure you login the same registry which you need to download the image?

If the build somehow works, but the pull fails that can be because you have that image locally so even if GitLabCI tries to pull the image before the build, it can continue without it. Since I don’t really know GitlabCI, I can be totally wrong.