
In this tutorial, we’ll look at how to quickly set up your GitLab server on Docker containers behind an NGINX reverse proxy. It is assumed that you already have the Docker and Compose application containerization engine installed, as well as the NGINX reverse proxy server.
The GitLab server will be available at gitlab.automationtools.me. Also, do not forget to add an A record for the gitlab.automationtools.me domain in DNS.
First, let’s create a directory structure for our GitLab:
mkdir gitlab
export GITLAB_HOME=$(pwd)/gitlab
Next, we are preparing the docker-compose.yml file to the following content:
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://gitlab.automationtools.me'
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
networks:
gitlab:
name: gitlab-network
Execute the build and run the containers:
docker-compose up -d
Checking the status of containers:
docker ps
We open the site gitlab.automationtools.me:8080 in the browser and try to log in. The root password can be obtained with the following command on the server:
docker exec -it gitlab-web-1 grep 'Password:' /etc/gitlab/initial_root_password