Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

850
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda