🌐
Medium
medium.com › @BuildWithLal › gitlab-setup-using-docker-compose-a-beginners-guide-3dbf1ef0cbb2
Setup GitLab Using Docker Compose: A Beginner’s Guide | by Lal Zada | Medium
October 10, 2024 - After a while, your GitLab container will be ready and running but you won’t be able to see your GitLab dashboard in the browser as we have not published it on any ports the way we did it in previous post by using -p 8000:80 . If you run docker ps , you will be seeing that the container is healthy and there is no port mapped from the host machine. Its only port 80 on the container side. ... Lets add the port mapping to the docker-compose.yml file.
Discussions

How to use Docker Compose In Gitlab CI
As I have tried to go with:| docker-compose-playgroound: stage: docker-compose-playgroound image: docker:18 services: - docker:18-dind tags: - docker-main variables: DOCKER_TLS_CERTDIR: "" DOCKER_HOST: tcp://docker:2375 script: - docker compose -f .gitlab/docker-compose-autotests.yml up However ... More on forum.gitlab.com
🌐 forum.gitlab.com
3
1
January 2, 2024
How to run gitlab locally using docker-compose on mac os?
*How can I run gitlab locally using docker-compose on macOS? I have tried different flavours of the docker-compose provided by git lab: web: image: 'gitlab/gitlab-ce:latest' restart: always hostname: 'gitlab.exam… More on forum.gitlab.com
🌐 forum.gitlab.com
3
0
January 15, 2021
Example GitLab Runner docker compose configuration
After having spent some time the other day to redo my (“standalone”) runner setup, I figured that I would share this for the benefit of the community. .env: RUNNER_NAME=RUNNER-NAME REGISTRATION_TOKEN=TOKEN CI_SERVER_UR… More on forum.gitlab.com
🌐 forum.gitlab.com
13
6
March 26, 2022
gitlab CE on premise: CI/CD with docker-compose stack
default: image: docker:28 stages: - build - deploy_dev before_script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY variables: BASE_HOST: 192.168.97.161 DOCKER_HOST: tcp://docker:2375 DOCKER_DRIVER: overlay2 DOCKER_TLS_CERTDIR: "" TAG_LATEST: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME/$CONTAINER_NAME:latest TAG_DEV_LATEST: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME/$CONTAINER_NAME:dev-latest TAG_COMMIT: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME/$CONTAINER_NAME:$CI_COMMIT_SHORT_SHA .build container: stage: build services: - name: docker:28-dind alias: mydockerhost script: # fetches the latest image (not failing if image is not found) - docker pull $TAG_LATEST || true - > docker build --pull --cache-from $TAG_LATEST --build-arg BUILDKIT_INLINE_CACHE=1 --tag $TAG_COMMIT --tag $TAG_DEV_LATEST ./$CONTAINER_NAME - docker push $TAG_COMMIT - docker push $TAG_DEV_LATEST only: changes: - $CONTAINER_NAME build customer: extends: .build container variables: DOCKERFILE_PATH: customer/Dockerfile CONTAINER_NAME: customer build db: extends: .build container variables: DOCKERFILE_PATH: db/Dockerfile CONTAINER_NAME: db build services: extends: .build container variables: DOCKERFILE_PATH: services/Dockerfile CONTAINER_NAME: services .deploy_dev_template: &deploy_dev_template stage: deploy_dev variables: #DOCKER_HOST: tcp://192.168.97.161:2375 DOCKER_HOST: ssh://$DCMP_PROD_DOCKER_USER@$DCMP_PROD_DOCKER_HOST COMPOSE_FILE: docker-compose-ci.yml COMPOSE_PROJECT_NAME: $CI_COMMIT_REF_SLUG HOST: $CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG.$BASE_HOST .deploy_dev: &deploy_dev <<: *deploy_dev_template script: - chmod og= $ID_RSA - eval $(ssh-agent -s) - ssh-add <(cat "$ID_RSA") - mkdir -p ~/.ssh - chmod 700 ~/.ssh - touch ~/.ssh/known_hosts - chmod 600 ~/.ssh/known_hosts - echo $DCMP_PROD_DOCKER_HOST_KEY >> ~/.ssh/known_hosts - docker info # debug - docker-compose config # debug - docker-compose version # debug # - ssh $DCMP_PROD_DOCKER_USER@$DCMP_PROD_DOCKER_HOST "docker ps" # works! - docker-compose pull - docker-compose up -d --no-build environment: name: $CI_COMMIT_REF_SLUG url: https://$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG.$BASE_HOST on_stop: stop_deploy_dev deploy_dev_auto: <<: *deploy_dev only: - ci_sgw - master - staging deploy_dev_manual: <<: *deploy_dev except: - master when: manual stop_deploy_dev: <<: *deploy_dev_template when: manual script: - docker-compose down --volumes environment: name: $CI_COMMIT_REF_SLUG action: stop More on reddit.com
🌐 r/gitlab
17
4
March 12, 2025
🌐
OneUptime
oneuptime.com › home › blog › how to run gitlab ce in docker (self-hosted)
How to Run GitLab CE in Docker (Self-Hosted)
February 8, 2026 - Always follow GitLab's upgrade path guidelines. Never skip major versions: # Pull the new image version docker compose pull # Stop and recreate the container docker compose up -d # Monitor the upgrade process docker compose logs -f gitlab
Author: sameersbn
🌐
DEV Community
dev.to › teetoflame › setting-up-a-gitlab-server-community-edition-and-a-gitlab-runner-using-docker-compose-ob6
Setting Up a GitLab Server (Community Edition) and a GitLab Runner Using Docker Compose - DEV Community
February 20, 2025 - Set up a Docker-based GitLab and a GitLab Runner using Docker Compose to create a CI/CD environment. Services will be defined in the docker-compose.yml file, configuring storage, exposing GitLab on a local port, and registering the GitLab Runner ...
🌐
Docker Hub
hub.docker.com › r › gitlab › gitlab-ce
gitlab/gitlab-ce - Docker Image
The official GitLab Community Edition Docker image is available on Docker Hub⁠.
🌐
GitLab
forum.gitlab.com › gitlab ci/cd
How to use Docker Compose In Gitlab CI - GitLab CI/CD - GitLab Forum
January 2, 2024 - As I have tried to go with:| docker-compose-playgroound: stage: docker-compose-playgroound image: docker:18 services: - docker:18-dind tags: - docker-main variables: DOCKER_TLS_CERTDIR: "" DOCKER_HOST: tcp://docker:2375 script: - docker compose -f .gitlab/docker-compose-autotests.yml up However ...
Find elsewhere
🌐
YouTube
youtube.com › watch
How to Install GitLab Using Docker Compose - Full Setup Guide - YouTube
↳👋🏾 I’m back with another tutorial📺, which is for installing GitLab using Docker Compose. 📽️ In this video, I’ll guide you through the entire process of ...
Published: September 26, 2024
🌐
GitLab
gitlab.com › gitlab.org › gitlab development kit › repository
docker-compose.yml · docker-compose · GitLab.org / GitLab Development Kit · GitLab
Get started with GitLab Rails development using the GDK. https://gitlab-org.gitlab.io/gitlab-development-kit/
🌐
GitLab
forum.gitlab.com › how to use gitlab
How to run gitlab locally using docker-compose on mac os? - How to Use GitLab - GitLab Forum
January 15, 2021 - *How can I run gitlab locally using docker-compose on macOS? I have tried different flavours of the docker-compose provided by git lab: web: image: 'gitlab/gitlab-ce:latest' restart: always hostname: 'gitlab.example.com' environment: GITLAB_OMNIBUS_CONFIG: | external_url 'https://gitlab.example.com' # Add any other gitlab.rb configuration here, each on its own line ports: - '80:80' - '443:443' - '22:22' volumes: - './.git/gitlab/config:/etc/gitlab' ...
🌐
GitLab
gitlab.com › gitlab.org › gitlab-compose-kit
GitLab.org / gitlab-compose-kit · GitLab
An alternative to GitLab Development Kit that is fully container-based and immutable
🌐
GitLab
forum.gitlab.com › gitlab ci/cd
Example GitLab Runner docker compose configuration - GitLab CI/CD - GitLab Forum
March 26, 2022 - After having spent some time the other day to redo my (“standalone”) runner setup, I figured that I would share this for the benefit of the community. .env: RUNNER_NAME=RUNNER-NAME REGISTRATION_TOKEN=TOKEN CI_SERVER_URL=https://gitlab.com/ docker-compose.yml: version: "3.5" services: dind: image: docker:20-dind restart: always privileged: true environment: DOCKER_TLS_CERTDIR: "" command: - --storage-driver=overlay2 runner: restart: always image:...
🌐
GitLab
gitlab.com › explore › ci/cd catalog
CI/CD Catalog · GitLab
• Components: gitlab-ci-docker-vault, gitlab-ci-docker, gitlab-ci-docker-acr, gitlab-ci-docker-ecr, gitlab-ci-docker-gcp
🌐
Reddit
reddit.com › r/gitlab › gitlab ce on premise: ci/cd with docker-compose stack
r/gitlab on Reddit: gitlab CE on premise: CI/CD with docker-compose stack
March 12, 2025 -

Could someone help me out here, I am lost here:

I try to set up a pipeline to (a) build 3 docker images and push them to a registry and (b) spawn a docker-compose stack using these images on a server in my LAN.

(a) works, I get the images tagged and pushed etc

I can also pull them etc

(b) I am confused right now how to do this elegantly:

I have Gitlab in a VM. Another VM is a docker-host, running a gitlab-runner with the docker executor. Contacting the runner works fine.

The pipeline should start the compose-stack on the same docker-host ... so the runner container starts a docker image for the pipeline which somehow in turn has to contact the docker-host.

I tried that by setting DOCKER_HOST=ssh://deployer@dockerhost

I have the ID_RSA and the HOST_KEY set up ... I even manage to get correct "docker info" within the ci-job from the dockerhost via ssh!

But "docker-compose pull" fails to contact the DOCKER_HOST :

$ docker-compose pull
 customer Pulling 
 db Pulling 
 services Pulling 

 db Error command [ssh -o ConnectTimeout=30 -l deployer -- 192.168.97.161 docker system dial-stdio] has exited with exit status 255, make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=ssh: connect to host 192.168.97.161 port 22: Host is unreachable

 services Error context canceled

 customer Error context canceled

error during connect: Post "http://docker.example.com/v1.41/images/create?fromImage=gitlab.x.com%3A5000%2Fsome%2Fproj%2Fci_sgw%2Fdb&tag=dev-latest": command [ssh -o ConnectTimeout=30 -l deployer -- 192.168.97.161 docker system dial-stdio] has exited with exit status 255, make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=ssh: connect to host 192.168.97.161 port 22: Host is unreachable

The same host ip and port is giving me correct "docker info" a second earlier, in the same job!

Is the "ssh://" URL correct? Is it the best way of doing? Do I have to use dind? I had the stack running inside dind already, but no idea how to access its ports then ;-)

Is there a more elegant way by accessing the docker inside the runner maybe?

I share my WIP here for discussion in a second posting.

Top answer
1 of 2
1
default: image: docker:28 stages: - build - deploy_dev before_script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY variables: BASE_HOST: 192.168.97.161 DOCKER_HOST: tcp://docker:2375 DOCKER_DRIVER: overlay2 DOCKER_TLS_CERTDIR: "" TAG_LATEST: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME/$CONTAINER_NAME:latest TAG_DEV_LATEST: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME/$CONTAINER_NAME:dev-latest TAG_COMMIT: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME/$CONTAINER_NAME:$CI_COMMIT_SHORT_SHA .build container: stage: build services: - name: docker:28-dind alias: mydockerhost script: # fetches the latest image (not failing if image is not found) - docker pull $TAG_LATEST || true - > docker build --pull --cache-from $TAG_LATEST --build-arg BUILDKIT_INLINE_CACHE=1 --tag $TAG_COMMIT --tag $TAG_DEV_LATEST ./$CONTAINER_NAME - docker push $TAG_COMMIT - docker push $TAG_DEV_LATEST only: changes: - $CONTAINER_NAME build customer: extends: .build container variables: DOCKERFILE_PATH: customer/Dockerfile CONTAINER_NAME: customer build db: extends: .build container variables: DOCKERFILE_PATH: db/Dockerfile CONTAINER_NAME: db build services: extends: .build container variables: DOCKERFILE_PATH: services/Dockerfile CONTAINER_NAME: services .deploy_dev_template: &deploy_dev_template stage: deploy_dev variables: #DOCKER_HOST: tcp://192.168.97.161:2375 DOCKER_HOST: ssh://$DCMP_PROD_DOCKER_USER@$DCMP_PROD_DOCKER_HOST COMPOSE_FILE: docker-compose-ci.yml COMPOSE_PROJECT_NAME: $CI_COMMIT_REF_SLUG HOST: $CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG.$BASE_HOST .deploy_dev: &deploy_dev <<: *deploy_dev_template script: - chmod og= $ID_RSA - eval $(ssh-agent -s) - ssh-add <(cat "$ID_RSA") - mkdir -p ~/.ssh - chmod 700 ~/.ssh - touch ~/.ssh/known_hosts - chmod 600 ~/.ssh/known_hosts - echo $DCMP_PROD_DOCKER_HOST_KEY >> ~/.ssh/known_hosts - docker info # debug - docker-compose config # debug - docker-compose version # debug # - ssh $DCMP_PROD_DOCKER_USER@$DCMP_PROD_DOCKER_HOST "docker ps" # works! - docker-compose pull - docker-compose up -d --no-build environment: name: $CI_COMMIT_REF_SLUG url: https://$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG.$BASE_HOST on_stop: stop_deploy_dev deploy_dev_auto: <<: *deploy_dev only: - ci_sgw - master - staging deploy_dev_manual: <<: *deploy_dev except: - master when: manual stop_deploy_dev: <<: *deploy_dev_template when: manual script: - docker-compose down --volumes environment: name: $CI_COMMIT_REF_SLUG action: stop
2 of 2
1
I have a similar setup and have been running it for years. The Registry tokens are only valid temporarily (I think it was a 15 minute window where the remote server can pull the images). Since your SSH connection is fine I won't go into that, however for pulling the images you can solve it by using a different token for pulling it to your servers. (This should also work for other nodes in the cluster if you use docker swarm) If you go to the project and go under Repository -> Deploy Tokens. You create a token with just the scope `read_registry`. Name it what ever you want, don't set a expiration date and leave username blank. Now save the username and token that is generated. I've put these variables into the CI/CD variables and called them REGISTRY_USER and REGISTRY_PASSWORD. With the following CI/CD snippet I deploy to my server. push to production: image: docker:27.1.2 stage: deploy variables: DOCKER_HOST: ssh://deploy@10.0.0.81 script: - apk add openssh-client --no-cache - mkdir -p ~/.ssh/ && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config - eval $(ssh-agent -s) - chmod 600 $SSH_KEY && ssh-add $SSH_KEY - docker login -u $REGISTRY_USER -p $REGISTRY_PASSWORD $CI_REGISTRY - docker stack deploy --prune --resolve-image=always --with-registry-auth --compose-file=docker-stack-compose.yml ${CI_PROJECT_NAMESPACE}-${CI_PROJECT_NAME} If you are still unable to pull the images. See if you can docker login https://yourgitlab.com and see if you can pull it manually. If that doesn't work there might be something blocking your connection with gitlab from that node.
🌐
n8n
docs.n8n.io › hosting › installation › server-setups › docker-compose
Docker Compose | n8n Docs
Create a compose.yaml file. Paste the following in the file: The Docker Compose file above configures two containers: one for n8n, and one to run traefik, an application proxy to manage TLS/SSL certificates and handle routing.
🌐
Railway
docs.railway.com › home › quick start
Quick Start Tutorial | Railway Docs
If you're using a registry other than Docker Hub (such as GitHub, GitLab, Quay), you need to provide the full Docker image URL from the respective registry.
🌐
Reddit
reddit.com › r/gitlab › a guide to installing gitlab ce on a vps using docker with nginx proxy and ssl via certbot
r/gitlab on Reddit: A guide to installing GitLab CE on a VPS using Docker with NGINX proxy and SSL via certbot
September 7, 2023 - Thanks for suggestions, docker-compose would definitely be of help if linked domain with nginx proxy and certbot is a must. ... Hey With Exitzero, you can effortlessly install crucial services such as GitLab, and many more with just a few clicks, saving you the hassle of navigating through ...
🌐
GitLab
forum.gitlab.com › gitlab ci/cd
How to use docker-compose.yml file in GitLab Runner server? - GitLab CI/CD - GitLab Forum
April 22, 2024 - Hello, I would be grateful if someone could clarify something for me. I have two servers: GitLab Server: Repositories GitLab Runner: Runner + Docker On my GitLab server I have created a project with some code. In the root directory of my project, I have placed two files, .gitlab-ci.yml and Dockerfile.
Starred by 30 users
Forked by 13 users
Languages: Shell 73.4% | Dockerfile 26.6%
🌐
Docker Docs
docs.docker.com › manuals › docker compose › install › install the docker compose plugin
Install the Docker Compose plugin | Docker Docs
May 28, 2026 - This command downloads and installs the latest release of Docker Compose for the active user under $HOME directory.