🌐
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 - First it will do docker pull gitlab/gitlab-ce if the gitlab/gitlab-ce docker image does not exist on your local machine. After pulling the docker image, it will do docker run gitlab/gitlab-ce · So you can see how docker compose combines 2 separate commands into a single YAML file.
🌐
GitLab
docs.gitlab.com › install › docker › installation
Install GitLab in a Docker container | GitLab Docs
The following examples use a stable Enterprise Edition version. If you want to use the Release Candidate (RC) or nightly image, use gitlab/gitlab-ee:rc or gitlab/gitlab-ee:nightly instead. To install the Community Edition, replace ee with ce. ... Install Docker Compose.
Discussions

How to use Docker Compose In Gitlab CI
What are valid way to run docker compose inside a 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: - ... More on forum.gitlab.com
🌐 forum.gitlab.com
3
1
January 2, 2024
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
0
6
March 26, 2022
Run docker-compose build in .gitlab-ci.yml - Stack Overflow
I have a .gitlab-ci.yml file which contains following: image: docker:latest services: - docker:dind before_script: - docker info - docker-compose --version buildJob: stage: build tags... More on stackoverflow.com
🌐 stackoverflow.com
How to use docker-compose.yml file in GitLab Runner server?
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 ... More on forum.gitlab.com
🌐 forum.gitlab.com
0
0
April 22, 2024
🌐
GitHub
github.com › sameersbn › docker-gitlab › blob › master › docker-compose.yml
docker-gitlab/docker-compose.yml at master · sameersbn/docker-gitlab
- GITLAB_SECRETS_ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=long-and-random-alphanumeric-string
Author   sameersbn
🌐
GitLab
forum.gitlab.com › gitlab ci/cd
How to use Docker Compose In Gitlab CI - GitLab CI/CD - GitLab Forum
January 2, 2024 - What are valid way to run docker compose inside a 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 it has resulted in error: $ docker compose -f .gitlab/docker-compose-autotes...
🌐
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 - The GitLab UI should be available at http://<your-EC2-public-IP>:8088. Initially, you might get a 502 error, but this should resolve as the services fully initialize. ... aws ec2 describe-security-groups --group-ids <your-security-group-id> --query "SecurityGroups[*].IpPermissions" ... Log in using root as the username and the password set in the docker-compose.yml file.
🌐
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:...
🌐
DevOps in the clouds
czerniga.it › strona główna › how to install gitlab using docker compose?
How to install GitLab using Docker Compose?
September 26, 2022 - For convenience, we will also set an environment variable that will contain the path to our Gitlab directory: ... # docker-compose.yml version: '3.7' services: web: image: 'gitlab/gitlab-ce:latest' restart: always hostname: 'localhost' container_name: gitlab-ce environment: GITLAB_OMNIBUS_CONFIG: | external_url 'http://localhost' ports: - '8080:80' - '8443:443' volumes: - '$GITLAB_HOME/config:/etc/gitlab' - '$GITLAB_HOME/logs:/var/log/gitlab' - '$GITLAB_HOME/data:/var/opt/gitlab' networks: - gitlab gitlab-runner: image: gitlab/gitlab-runner:alpine container_name: gitlab-runner restart: always depends_on: - web volumes: - /var/run/docker.sock:/var/run/docker.sock - '$GITLAB_HOME/gitlab-runner:/etc/gitlab-runner' networks: - gitlab networks: gitlab: name: gitlab-network
🌐
GitHub
github.com › mgcrea › docker-compose-gitlab-ce
GitHub - mgcrea/docker-compose-gitlab-ce: Compose file for Gitlab Community Edition · GitHub
You can quickly start your compose gitlab instance (requires a working automated nginx_proxy compose instance) git clone git@github.com:mgcrea/docker-compose-gitlab-ce.git gitlab; cd $_ cp .env.default .env; nano .env make docker-compose up -d
Starred by 113 users
Forked by 42 users
Languages   Ruby 88.0% | Makefile 9.4% | Shell 2.6%
Find elsewhere
🌐
Medium
medium.com › @vitalypanukhin › docker-compose-and-gitlab-b209d09210f6
Docker Compose and GitLab. A walkthrough of how to deploy your app… | by Vitaly Panyukhin | Medium
May 20, 2020 - The values could be soursed from GitLab vault or from the variables written in the .gitlab-ci.yml file. Then Docker Compose are using .env file to read the values and pass them to OS variables of relevant containers.
🌐
Atlantic.Net
atlantic.net › home › blog › how to install gitlab with docker and docker compose on arch linux
How to install GitLab with Docker and Docker Compose on Arch Linux
June 2, 2024 - version: '3.7' services: web: image: 'gitlab/gitlab-ce:latest' restart: always hostname: 'localhost' container_name: gitlab-ce environment: GITLAB_OMNIBUS_CONFIG: | external_url 'http://localhost' ports: - '8080:80' - '8443:443' volumes: - '$GITLAB_HOME/config:/etc/gitlab' - '$GITLAB_HOME/logs:/var/log/gitlab' - '$GITLAB_HOME/data:/var/opt/gitlab' networks: - gitlab gitlab-runner: image: gitlab/gitlab-runner:alpine container_name: gitlab-runner restart: always depends_on: - web volumes: - /var/run/docker.sock:/var/run/docker.sock - '$GITLAB_HOME/gitlab-runner:/etc/gitlab-runner' networks: - gitlab networks: gitlab: name: gitlab-network · Save and close the file when you are done. At this point, the docker-compose.yml file is ready to start the GitLab container.
Top answer
1 of 11
120

EDIT (2023): Do not keep using docker-compose! Please migrate to docker compose, which is now part of the docker image and a 99% drop-in replacement of docker-compose. Ironically, if you (now) use docker:latest, the question does not apply. See Docker's documentation on Compose V2. The answer below only applies to docker-compose, AKA Compose V1, which is to be discontinued/become unsupported.


Docker also provides an official docker-compose image: docker/compose

This is the ideal solution if you don't want to install it every pipeline.

Note that in the latest version of GitLab CI/Docker you will likely need to give privileged access to your GitLab CI Runner and configure/disable TLS. See Use docker-in-docker workflow with Docker executor

variables:
  DOCKER_HOST: tcp://docker:2375/
  DOCKER_DRIVER: overlay2

# Official docker compose image.
image:
  name: docker/compose:latest

services:
  - docker:dind

before_script:
  - docker version
  - docker-compose version

build:
  stage: build
  script:
    - docker-compose down
    - docker-compose build
    - docker-compose up tester-image

Note that in versions of docker-compose earlier than 1.25:

Since the image uses docker-compose-entrypoint.sh as entrypoint you'll need to override it back to /bin/sh -c in your .gitlab-ci.yml. Otherwise your pipeline will fail with No such command: sh

    image:
      name: docker/compose:latest
      entrypoint: ["/bin/sh", "-c"]
2 of 11
99

Following the official documentation:

# .gitlab-ci.yml
image: docker
services:
  - docker:dind    
build:
  script:
    - apk add --no-cache docker-compose
    - docker-compose up -d

Sample docker-compose.yml:

version: "3.7"
services:
  foo:
    image: alpine
    command: sleep 3
  bar:
    image: alpine
    command: sleep 3

We personally do not follow this flow anymore, because you loose control about the running containers and they might end up running endless. This is because of the docker-in-docker executor. We developed a python-script as a workaround to kill all old containers in our CI, which can be found here. But I do not suggest to start containers like this anymore.

🌐
Mike Polinowski
mpolinowski.github.io › devops › gitops › install gitlab with docker-compose (debian bullseye)
Install Gitlab with Docker-Compose (Debian Bullseye) | Mike Polinowski
docker-compose up -d docker-compose ps Name Command State Ports ---------------------------------------------------------------------------------------------------------- gitlab-ce /assets/wrapper Up (unhealthy) 0.0.0.0:2222->22/tcp,:::2222->22/tcp, 0.0.0.0:8443->443/tcp,:::8443->443/tcp, 0.0.0.0:80->80/tcp,:::80->80/tcp · Visit https://gitlab.example...
🌐
GitHub
github.com › hutchgrant › gitlab-docker-local
GitHub - hutchgrant/gitlab-docker-local: Install, configure, and run Gitlab CE and Gitlab-Runner in local docker containers via docker-compose. · GitHub
Install, configure, and run Gitlab CE and Gitlab-Runner in local docker containers via docker-compose. ... For the purpose of this demonstration, we will be assuming the persistent docker volumes will be at the path /srv/gitlab and ...
Starred by 30 users
Forked by 14 users
Languages   Shell 73.4% | Dockerfile 26.6%
🌐
ComputingForGeeks
computingforgeeks.com › home › run gitlab ce in docker with docker compose
Run GitLab in Docker Containers using Docker Compose [Guide]
2 weeks ago - If you prefer the latest Docker CE from the official Docker repository instead, follow our guide on installing Docker CE on Linux. The compose syntax is identical either way. ... sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw allow 2222/tcp sudo ufw allow OpenSSH sudo ufw enable · GitLab should always run behind HTTPS. Before bringing up the container, obtain a Let’s Encrypt certificate. If your server has a public IP, use the standalone method: sudo apt install -y certbot sudo certbot certonly --standalone -d gitlab.example.com --non-interactive --agree-tos -m [email protected]
🌐
GitHub
gist.github.com › bkuhl › 3487ec4557eee8de6700d6a0ab058e72
How to use docker-compose in GitLab CI · GitHub
image: tmaier/docker-compose:latest services: - docker:dind before_script: - docker info - docker-compose --version build image: stage: build script: - docker-compose build
🌐
GitHub
gist.github.com › benoitpetit › cbe19cdd369ec8c1e0defd245d91751f
complete Gitlab installation and a runner with docker · GitHub
Thanks! :-) I found an auto register version for the runner for inspiration of your work and this combined might be helpful for those passing by: https://gitlab.com/TyIsI/gitlab-runner-docker-compose/-/blob/main/docker-compose.yml?ref_type=heads
🌐
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 - 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 ...
🌐
Cylab
cylab.be › blog › 229 › continuous-deployment-with-gitlab-and-docker-compose
Continuous Deployment with GitLab and docker-compose | cylab.be
September 19, 2023 - The example below is for a Laravel project. You can tune it for your needs: # # docker-compose.tmpl # https://cylab.be/blog/229/continuous-deployment-with-gitlab-and-docker # $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA # version: "3.7" services: web: image: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA depends_on: - redis - mysql ports: - "80" volumes: - ./volumes/web:/var/www/html/storage restart: "unless-stopped" environment: WAIT_HOSTS: mysql:3306 queue: image: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA depends_on: - web volumes: - ./volumes/web:/var/www/html/storage command: ["php", "artisan", "queue:work", "--verbose"]
🌐
GitLab
docs.gitlab.com › install › docker › configuration
Configure GitLab running in a Docker container | GitLab Docs
Following the previous example, your web browser can reach your GitLab instance at <hostIP>:8929 and push over SSH on port 2424. You can see a docker-compose.yml example that uses different ports in the Docker compose section.
🌐
GitHub
github.com › sameersbn › docker-gitlab
GitHub - sameersbn/docker-gitlab: Dockerized GitLab
All the above environment variables can be put into a secrets or config file and then both docker-compose and Docker Swarm can import them into your gitlab container. On startup, the gitlab container will source env vars from a config file labeled gitlab-config, and then a secrets file labeled gitlab-secrets (both mounted in the default locations). See the example contrib/docker-swarm/docker-compose.yml file, and the example gitlab.configs and gitlab.secrets file.
Starred by 8.1K users
Forked by 2.2K users
Languages   Shell 91.0% | Ruby 5.0% | Dockerfile 2.8% | Makefile 1.2% | Shell 91.0% | Ruby 5.0% | Dockerfile 2.8% | Makefile 1.2%