
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.
High system requirements: GitLab is a resource-intensive application. We recommend a server with at least 4 CPU cores and 8 GB of RAM for a stable experience.
Step 1: Create the Docker Compose File
Log in to your server via SSH, create a directory for GitLab, and open the Compose file:
Paste the following configuration into the file. You will customize the domain in the next step.
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:
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:
Be patient: The first startup requires GitLab to initialize and configure itself. This can take 5 to 15 minutes or longer. The instance will not be accessible until this process is complete. You can monitor the status with docker ps.
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:
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:
| Field | Value |
|---|---|
| Username | root |
| Password | The password retrieved in Step 4 |
Change your root password immediately after the first login via the user profile settings.
Further Documentation
For advanced configuration, CI/CD setup, and administration guides, refer to the official GitLab documentation.