
GitLab CE (Community Edition) is a complete, open-source DevOps platform. Unlike lightweight alternatives, GitLab provides a comprehensive suite of tools in a single application, including source code management, CI/CD pipelines, security testing, and project planning.
This article demonstrates how to deploy GitLab CE on Ubuntu 24.04 using Docker Compose and secure it with HTTPS via a Traefik reverse proxy.
Before you begin:
gitlab.example.com, to point to your server’s public IP address.Set up the project directory to store persistent GitLab configuration, logs, data, and Let's Encrypt certificates.
Create folders to store GitLab volumes and Let's Encrypt certificates.
config - GitLab configuration files.logs - Logs for the various bundled services.data - Repositories and database data.letsencrypt - Traefik ACME certificates.Navigate to the root GitLab directory.
Create a file named .env in the project directory to store the environment variables.
Add these values:
Replace gitlab.example.com with your domain and admin@example.com with your email. Save and close the file.
Deploy GitLab with Docker Compose using the official Omnibus image and Traefik as the reverse proxy.
Add your user account to the docker user group.
Apply new group membership.
Create and edit a Docker Compose manifest file.
Add the following contents:
Save and close the file. This Docker Compose file deploys GitLab CE behind Traefik, enabling secure HTTPS access using Let’s Encrypt. Each service has a specific purpose:
gitlab service
Runs the official gitlab/gitlab-ce Omnibus image, providing the full GitLab platform including repositories, issues, CI/CD pipelines, container registry, and administrative tools.
Stores configuration, logs, and persistent application data in the ./config, ./logs, and ./data directories.
Uses the GITLAB_OMNIBUS_CONFIG environment block to:
Exposes port 80 internally for the web interface, while Traefik routes external HTTPS traffic to this internal port.
traefik service
${GITLAB_DOMAIN}) to GitLab over HTTPS../letsencrypt directory.Start all services in detached mode.
Check container status.
GitLab takes a few minutes to start the first time. The container status may say health: starting for several minutes before the web interface is accessible.
For more information on managing a Docker Compose stack, see the How To Use Docker Compose article.
Retrieve the initial root password. GitLab generates a random password for the root user on the first run.
Copy the password string displayed in the output.
This file is automatically deleted after 24 hours. Ensure you change your password immediately after logging in.
Open your browser and visit your GitLab domain https://gitlab.example.com.
Log in using the username root and the password you retrieved in the previous step.
Once logged in, navigate to Admin area > Users to create a new user and set a new, secure password.
By following this article, you successfully deployed GitLab CE on Ubuntu 24.04 using Docker Compose. You have configured Traefik to handle HTTPS termination and mapped a custom SSH port for repository interaction. For more information, refer to GitLab Docs.
0 Comments
Be the first to comment and share your perspective with the community.