Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

848
Visualizações
Pull Image from Gitlab Registry in Docker Compose File

I want to deploy a docker stack on my own server. I've written a .gitlab-ci.yml file that currently builds the images in my stack and pushes them to my gitlab registry:

build:
  stage: build
  image: docker:stable
  services: 
    - docker:dind
  before_script:
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
    - docker info
  script:
    - docker build -t $DOCKER_IMAGE1_TAG -f dir1/Dockerfile ./dir1
    - docker push $DOCKER_IMAGE1_TAG
    - docker build -t $DOCKER_IMAGE2_TAG -f dir2/Dockerfile ./dir2
    - docker push $DOCKER_IMAGE2_TAG  

I'm struggling for a way to run the docker deploy command on my own server with the docker-compose.yml file I've written, that successfully pulls the images from my gitlab registry. I figure I could use sshpass to ssh into my server and then copy the docker-compose.yml file across and run docker deploy from there, but I'm not sure what's the best way to allow my server to access the images now located in my gitlab registry:

# Need to ssh into the server, transfer over docker-stack file and run docker swarm deploy
deploy:
  stage: deploy
  environment:
    name: production
  image: trion/ng-cli-karma
  before_script:
    - apt-get update -qq && apt-get install -y -qq sshpass
    - eval $(ssh-agent -s)

This is a section of my docker-compse file:

version: "3.2"
services:
  octeditor:
    image: image # how to set this to the image in my container registry?
    ports:
      - "3000:3000"
    networks:
      - front-tier
    deploy:
      replicas: 1
      update_config:
        parallelism: 1
      failure_action: rollback
      placement:
        constraints:
          - 'node.role == manager'
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s

How can I pull the images from my gitlab registry? Is this the preferred way of creating a docker deployment on a remote server, via gitlab ci?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I equally had this difficulty recently, finally I found out that the solution is just to insert the link to the image in the private registry as is the case for me with gitlab.

version: "3.2"
services:
  octeditor:
    image: registry.gitlab.com/project-or-group/project-name/image-name:tag
    ports:
      - "3000:3000"
    networks:
      - front-tier


over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda