Self-hosted GitLab: server requirements, Docker and cost
Published · updated
To self-host GitLab you need one Linux server with Docker or GitLab's own package, and GitLab's baseline for a single server is 8 vCPU and 16 GB of memory. On our price list that is a dedicated Core i3-1315U with 8 threads, 16 GB and a 256 GB NVMe drive for $39 a month; a team of up to five can also run a tuned GitLab on a VPS with 4 GB for $11.74.
The GitLab facts below come from its documentation and price page as we read them on 28 November 2026. Our prices are from our price list on the same day, per month and without tax.
How big a server GitLab needs
GitLab's requirements page gives 8 vCPU and 16 GB of memory as the baseline for one server. It says burstable instances are not recommended, it wants SSD storage, and it asks for 40 GB for the application, plus room for every repository and 5 to 10 GB for the PostgreSQL database. PostgreSQL is the only database GitLab supports, and the package and the Docker image bring their own.
There is a smaller way. GitLab's guide for memory-constrained environments runs it on 2 GB of memory plus 1 GB of swap, 2.5 GB being the better figure, with 20 GB of storage. It is meant for up to five developers with repositories smaller than 100 MB each, and it gets there by switching things off: Puma runs as a single process, Sidekiq runs 10 jobs at a time instead of 20, and the built-in Prometheus monitoring is turned off. The guide also suggests the free Community Edition when memory is tight.
| Use | Server | Per month |
|---|---|---|
| Up to 5 developers, tuned for low memory | VPS, 2 vCPU, 4 GB, 40 GB NVMe | $11.74 |
| GitLab's baseline, 8 vCPU and 16 GB | VPS, 8 vCPU, 16 GB, 100 GB NVMe | $44.56 |
| GitLab's baseline on cores nobody shares | Dedicated Core i3-1315U, 8 threads, 16 GB, 256 GB NVMe | $39 |
| GitLab and CI runners on one machine | Dedicated Ryzen 7 6800H, 16 threads, 32 GB, 256 GB NVMe | $79 |
| Large repositories and a container registry | Dedicated Ryzen 9 7945HX, 32 threads, 64 GB, 512 GB NVMe | $149 |
The first two rows follow GitLab's own figures; the other three are our suggestion. At GitLab's baseline a dedicated server costs less than a VPS of the same size, and its threads are not shared with other customers, which is what GitLab means when it warns against burstable instances. The Core i3-1315U has 6 cores, 2 of them performance cores, and runs 8 threads. If you plan to run CI jobs on the same machine, take the Ryzen 7: a pipeline that builds containers can use every thread it finds.
GitLab's reference architectures put 1,000 users at about 20 requests per second to the API, and recommend a single server, without high availability, up to 2,000 users. Most self-hosted GitLabs are far smaller than that.
Run it with Docker Compose
The images are gitlab/gitlab-ce for the free Community Edition and gitlab/gitlab-ee for the Enterprise Edition. Pin a version tag rather than latest, because a backup restores only to the same version. GitLab keeps its data in three folders that you mount from the server: configuration, logs and data.
services:
gitlab:
image: gitlab/gitlab-ce:<version>-ce.0
container_name: gitlab
restart: always
hostname: gitlab.example.com
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.example.com'
gitlab_rails['gitlab_shell_ssh_port'] = 2424
ports:
- '80:80'
- '443:443'
- '2424:22'
volumes:
- ./config:/etc/gitlab
- ./logs:/var/log/gitlab
- ./data:/var/opt/gitlab
shm_size: '256m'
external_url is the address your team will use, so point that domain to the server first. Every server of ours has a dedicated public IPv4 address and a 1 Gbit/s port.
The port 22 clash
Your server's own SSH already listens on port 22, and GitLab wants port 22 for git over SSH. GitLab's Docker guide gives two ways out: move the server's SSH to another port, or leave it alone and publish GitLab's SSH on another port, as in the file above. If you do the second, set gitlab_shell_ssh_port to the same number, or the clone addresses GitLab shows will still say port 22.
Docker opens ports past ufw
Our servers start with a firewall that has only SSH open. Docker routes traffic to published ports before ufw's rules apply, so 80, 443 and 2424 in the file above are reachable from the internet whatever ufw says. For GitLab that is usually what you want, but it also means closing those ports in ufw does nothing. To keep a port private, bind it to 127.0.0.1 in the compose file.
The first login
GitLab creates a root account with a random password and writes it to /etc/gitlab/initial_root_password inside the container. Read it with docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password and change it at once: GitLab deletes that file at the first restart after 24 hours. The image has no mail server, so set up SMTP in gitlab.rb if you want password resets and notifications to arrive.
Backups that you can restore
Run docker exec -t gitlab gitlab-backup create from the server's crontab. It saves the database, the repositories and uploads, but not the configuration folder, so it leaves out gitlab.rb and gitlab-secrets.json. Without gitlab-secrets.json a restored GitLab cannot read its encrypted data, such as CI variables and two-factor settings, so copy the config folder with every backup and keep both on another machine.
A backup restores only to exactly the same GitLab version and the same edition, CE or EE. Note the version tag next to each backup, and try one restore on a spare server before you need it.
What it costs against GitLab.com
GitLab.com Free costs nothing but limits a private group to 5 users, 400 compute minutes a month and 10 GiB of storage per project. Premium is $29 per user a month, billed yearly, so a team of ten pays $290 a month. Self-managed GitLab Community Edition is free with no limit on users; you pay for the server and do the updates and backups yourself.
For that team of ten, a dedicated Core i3-1315U at GitLab's baseline costs $39 a month and a Ryzen 7 6800H with room for CI runners $79, with no setup fee, 5% less on 3 months and 10% less on 6 months. What you give up is GitLab's hosting and its paid features; what you get is the code on your own machine, with no minute counter on your pipelines.
Questions
What are the GitLab self-hosted requirements?
GitLab's baseline for a single server is 8 vCPU and 16 GB of memory, with SSD storage: 40 GB for the application plus your repositories and 5 to 10 GB for PostgreSQL. With its memory-constrained settings, GitLab runs for up to five developers on 2.5 GB of memory plus 1 GB of swap.
Can GitLab run on 4 GB of RAM?
Yes, for a small team, if you apply GitLab's settings for memory-constrained environments: a single Puma process, Sidekiq at 10 jobs and Prometheus turned off. GitLab aims those settings at up to five developers with repositories under 100 MB.
How much does it cost to self-host GitLab?
GitLab Community Edition is free. On our price list, a VPS with 2 vCPU, 4 GB and 40 GB of NVMe for a small team costs $11.74 a month, and a dedicated Core i3-1315U with 8 threads and 16 GB, GitLab's baseline, costs $39 a month, with no setup fee.
Does the GitLab backup include gitlab-secrets.json?
No. gitlab-backup create leaves out the configuration folder, which holds gitlab.rb and gitlab-secrets.json. Copy that folder separately with every backup, or a restored GitLab cannot decrypt CI variables and two-factor settings.
Sources, read on 28 November 2026: GitLab installation requirements, Running GitLab in a memory-constrained environment, Install GitLab in a Docker container, Reference architectures, Back up GitLab, GitLab pricing, Docker and ufw.
Written and checked by the VPS Provider team.