Working docker-compose.yml for official gitlab-ce docker images leveraging separate instances for services:
- Uses official postgres docker image
- Uses official redis docker image
- Comes with a gitlab-runner instance
Made to work behind a separate automated nginx-proxy with SSL support via letsencrypt.
- You can quickly start your compose gitlab instance (requires a working automated nginx_proxy compose instance)
git clone https://github.com/amaan-igs/docker-compose-gitlab-ce.git gitlab; cd $_
cp .env.default .env; nano .env
sudo rm volumes/postgres/.gitkeep # Required: Remove .gitkeep to allow PostgreSQL initialization
make
docker compose up -dThe compose file includes a GitLab Runner container, but it needs to be registered with your GitLab instance.
- Go to
https://<yourdomain>/admin/runnersin your GitLab instance - Click on the three-dot menu next to the "New instance runner" button
- Copy the registration token
- Run the following command (replace
YOUR_TOKENwith the copied token):
docker exec -it gitlab_runner gitlab-runner register \
--non-interactive \
--url "http://gitlab" \
--registration-token "YOUR_TOKEN" \
--executor "docker" \
--docker-image "alpine:latest" \
--description "docker-runner" \
--tag-list "docker,linux" \
--run-untagged="true" \
--locked="false" \
--docker-network-mode "docker-compose-gitlab-ce_default"For runners outside of this compose setup:
- Go to
https://<yourdomain>/admin/runners - Click on the three-dot menu next to "New instance runner"
- Select "Show runner installation and registration instructions"
- Follow the instructions for your platform
source .env
docker run --rm -it gitlab/gitlab-ce:${GITLAB_CE_VERSION} postgres --version