Application Guides

How can we help?

Guides and technical documentation for your Server4You dedicated server or VPS.

GitLab Logo

Install GitLab with Docker

This guide shows how to run a self-managed GitLab CE instance with the official Docker image and Docker Compose on your Linux server. GitLab combines Git repositories, CI/CD pipelines and issue tracking in one platform.

Step 1: Create the Docker Compose File

Log in to your server via SSH, create a directory for GitLab, and open the Compose file:

Create Directory and File
mkdir gitlab && cd gitlab && nano docker-compose.yml

Paste the following configuration into the file. You will customize the domain in the next step.

docker-compose.yml
services: web: image: 'gitlab/gitlab-ce:latest' restart: always hostname: 'gitlab.example.com' environment: GITLAB_OMNIBUS_CONFIG: | external_url 'https://gitlab.example.com' ports: - '80:80' - '443:443' - '2222:22' volumes: - '$GITLAB_HOME/config:/etc/gitlab' - '$GITLAB_HOME/logs:/var/log/gitlab' - '$GITLAB_HOME/data:/var/opt/gitlab' shm_size: '256m'

Step 2: Configure Your Domain

Before starting GitLab, replace all instances of gitlab.example.com in the Compose file with your actual domain (e.g. gitlab.yourdomain.com). Also make sure your domain's DNS A record points to your server's IP address.

You also need to set the $GITLAB_HOME environment variable, which defines where GitLab stores its data. Run the following in the same directory as your Compose file:

Set GITLAB_HOME Variable
export GITLAB_HOME=$(pwd)

To make this persistent across reboots, add the line to your ~/.bashrc or ~/.profile.

Step 3: Start GitLab

Start the GitLab instance with the following command:

Start Docker Compose
docker compose up -d

Step 4: Retrieve the Initial Root Password

GitLab automatically generates a secure password for the initial root administrator account. Once the container is healthy, retrieve it with the following command:

Retrieve Root Password
docker compose exec -T web grep 'Password:' /etc/gitlab/initial_root_password > initial_password.txt

View the password with cat initial_password.txt. Make sure to save it somewhere safe and delete the file afterwards — it is automatically removed after 24 hours.

Step 5: First Login

Open your browser and navigate to the domain you configured (e.g. https://gitlab.yourdomain.com). Log in with the following credentials:

FieldValue
Usernameroot
PasswordThe password retrieved in Step 4

Further Documentation

For advanced configuration, CI/CD setup, and administration guides, refer to the official GitLab documentation.