📋
A Journey From IT to IT Security
  • IT Training Resources
  • IT Security Roles
    • Web Application Security Specialist
      • Training Guide
      • Self-hosted Training Lab
        • Vulnerable Web Apps
      • Web Security testing Methodology
        • 1 Footprinting
        • 2 Scanning
        • 3 Enumeration
        • 4 Gaining Access
        • 5 Maintain Access
        • 6 Covering Tracks
        • 7 Vulnerability assessment
    • DevSecOps Engineer
      • Training Guide
      • Building a DevSecOps CD/CI Pipeline
        • Self-hosted DevOps CD/CI platforms
        • Software Component Analysis (SCA)
        • Static Application Security Testing (SAST)
        • Dynamic Application Security Testing (DAST)
        • System Hardening
        • System Compliance Analysis
        • Vulnerability Analysis
      • Ready-to-use and train DevSecOps CD/CI Pipeline
    • Chief Information Security Officer (CISO)
    • Digital Forensics Investigator
      • Forensics Methodology
    • Cloud Security Engineer
      • Getting started with kubernetes
  • Resources
    • IT Basics
      • Networking Basics Study Guide
      • RBAC / ABAC
      • Anonymous Surfing
      • Python Programming
      • Infrastructure as code
      • Containers
        • Docker
        • Docker security
      • The Security Development Lifecycle (SDL)
    • Literature
    • Useful Tool Tutorials
    • Useful Online Tools
    • Exploits
  • Unsorted
    • Gitlab-ci with docker-compose
Powered by GitBook
On this page
  • OUTDATED DOESN'T WORK
  • Gitlab-ci with docker-compose
  1. Unsorted

Gitlab-ci with docker-compose

OUTDATED DOESN'T WORK

Gitlab-ci with docker-compose

I use docker-compose and the following dockerfile to create the gitlab web instance as well as a docker runner on the same machine.

version: '3.9'

services:
  gitlab-web:
    image: gitlab/gitlab-ce:latest
    restart: unless-stopped
    container_name: gitlab-web
    hostname: gitlab-web
    volumes:
      - '$GITLAB_HOME/config:/etc/gitlab'
      - '$GITLAB_HOME/logs:/var/log/gitlab'
      - '$GITLAB_HOME/data:/var/opt/gitlab'
    ports:
      - '2222:22'
      - '8080:80'
      - '443:443'
      - '4567:4567'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        gitlab_rails['initial_root_password'] = '${INITIAL_ROOT_PASSWORD}'
        gitlab_rails['initial_shared_runners_registration_token'] = "${INITIAL_RUNNER_TOKEN}"
        alertmanager['flags'] = {
          'cluster.advertise-address' => "127.0.0.1:9093",
          'web.listen-address' => "localhost:9093",
          'storage.path' => "/var/opt/gitlab/alertmanager/data",
          'config.file' => "/var/opt/gitlab/alertmanager/alertmanager.yml"
        }
    networks:
      - default

  gitlab-runner:
    image: gitlab/gitlab-runner:latest
    container_name: gitlab-runner
    hostname: gitlab-runner
    depends_on:
      - gitlab-web
    volumes:
      - './gitlab-runner-config:/etc/gitlab-runner:Z'
      - '/var/run/docker.sock:/var/run/docker.sock'

networks:
    default:

global variables are stored in a .env file:

INITIAL_ROOT_PASSWORD=supersecretpass
INITIAL_RUNNER_TOKEN=o8Yesbgz5hPWVLQqxWF3
GITLAB_HOME=/srv/gitlab
HOST_NAME=gitlab.example.com

Run the file with

docker-compose up -d

You can observe the status of your gitlab-web instance with

docker-compose ps
docker logs -f gitlab-web

If you run into configuration troubles you need to enter the container to make changes to the gitlab.rb file and call gitlab reconfigure

docker container exec -it gitlab-web /bin/bash
$ vi /etc/gitlab/gitlab.rb

Exit the container (CTRL+D) and check the logs with

docker logs gitlab-web

Pay attention the fix to gitlab.rb is not permanent, reconfigure or restart the container will remove your change and you have to do it again. You need to put the correct configuration into the dockerfile at GITLAB_OMNIBUS_CONFIG

More

PreviousExploits

Last updated 3 years ago

Run a docker container as described here

Another good installation guide is available here:

https://docs.gitlab.com/omnibus/docker/
https://oramind.com/private-cicd-using-gitlab-docker/
Logoalertmanager down with "create memberlist: Failed to get final advertise address: Failed to parse advertise address \"<nil>\"" (#3705) · Issues · GitLab.org / omnibus-gitlabGitLab