GitLab is a complete DevOps platform that allows you to manage your Git repositories, run CI/CD pipelines, track issues, and much more. The official and most straightforward way to run a self-managed GitLab instance is by using their Docker image.
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 smooth experience.
Installation Steps
First, log into your server via SSH. Create a directory for your GitLab project and then create the docker-compose.yml file within it.
Create Directory and File
mkdir gitlab
cd gitlab
nano docker-compose.yml
Paste the following official configuration into the docker-compose.yml file:
docker-compose.yml
version: '3.6'
services:
web:
image: 'gitlab/gitlab-ce:latest'
restart: always
hostname: 'gitlab.example.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.example.com'
# Add any other gitlab.rb configuration here, each on its own line
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'