info:To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
type:index
---
# Install GitLab with Docker **(FREE SELF)**
# GitLab Docker images
[Docker](https://www.docker.com) and container technology have been revolutionizing the software world for the past few years. They combine the performance and efficiency of native execution with the abstraction, security, and immutability of virtualization.
The GitLab Docker images are monolithic images of GitLab running all the
necessary services in a single container. If you instead want to install GitLab
on Kubernetes, see [GitLab Helm Charts](https://docs.gitlab.com/charts/).
GitLab provides official Docker images allowing you to easily take advantage of the benefits of containerization while operating your GitLab instance. A [complete usage guide](https://docs.gitlab.com/omnibus/docker/) for these images is available, as well as the [Dockerfile used for building the images](https://gitlab.com/gitlab-org/omnibus-gitlab/tree/master/docker).
Find the GitLab official Docker image at:
There's also a [Docker image for GitLab Runner](https://docs.gitlab.com/runner/install/docker.html).
-[GitLab Docker image in Docker Hub](https://hub.docker.com/r/gitlab/gitlab-ee/)
## Cloud native images
The Docker images don't include a mail transport agent (MTA). The recommended
solution is to add an MTA (such as Postfix or Sendmail) running in a separate
container. As another option, you can install an MTA directly in the GitLab
container, but this adds maintenance overhead as you'll likely need to reinstall
the MTA after every upgrade or restart.
GitLab is also working towards a [cloud native set of containers](https://docs.gitlab.com/charts/), with a single image for each component service.
In the following examples, if you want to use the latest RC image, use
`gitlab/gitlab-ee:rc` instead.
WARNING:
Docker for Windows is not officially supported. There are known issues with volume
permissions, and potentially other unknown issues. If you are trying to run on Docker
for Windows, see the [getting help page](https://about.gitlab.com/get-help/) for links
to community resources (IRC, forum, etc.) to seek help from other users.
## Prerequisites
Docker is required. See the [official installation documentation](https://docs.docker.com/install/).
## Set up the volumes location
Before setting everything else, configure a new environment variable `$GITLAB_HOME`
pointing to the directory where the configuration, logs, and data files will reside.
Ensure that the directory exists and appropriate permission have been granted.
For Linux users, set the path to `/srv/gitlab`:
```shell
export GITLAB_HOME=/srv/gitlab
```
For macOS users, use the user's `$HOME/gitlab` directory:
```shell
export GITLAB_HOME=$HOME/gitlab
```
The GitLab container uses host mounted volumes to store persistent data:
The default group is `docker`. If you changed the group, be sure to update your
commands.
### /dev/shm mount not having enough space in Docker container
GitLab comes with a Prometheus metrics endpoint at `/-/metrics` to expose a
variety of statistics on the health and performance of GitLab. The files
required for this gets written to a temporary file system (like `/run` or
`/dev/shm`).
By default, Docker allocates 64Mb to the shared memory directory (mounted at
`/dev/shm`). This is insufficient to hold all the Prometheus metrics related
files generated, and will generate error logs like the following:
```plaintext
writing value to /dev/shm/gitlab/sidekiq/gauge_all_sidekiq_0-1.db failed with unmapped file
writing value to /dev/shm/gitlab/sidekiq/gauge_all_sidekiq_0-1.db failed with unmapped file
writing value to /dev/shm/gitlab/sidekiq/gauge_all_sidekiq_0-1.db failed with unmapped file
writing value to /dev/shm/gitlab/sidekiq/histogram_sidekiq_0-0.db failed with unmapped file
writing value to /dev/shm/gitlab/sidekiq/histogram_sidekiq_0-0.db failed with unmapped file
writing value to /dev/shm/gitlab/sidekiq/histogram_sidekiq_0-0.db failed with unmapped file
writing value to /dev/shm/gitlab/sidekiq/histogram_sidekiq_0-0.db failed with unmapped file
```
Other than disabling the Prometheus Metrics from the Admin page, the recommended
solution to fix this problem is to increase the size of shm to at least 256Mb.
If using `docker run`, this can be done by passing the flag `--shm-size 256m`.
If using a `docker-compose.yml` file, the `shm_size` key can be used for this
purpose.
### Docker containers exhausts space due to the `json-file`
Docker's [default logging driver is `json-file`](https://docs.docker.com/config/containers/logging/configure/#configure-the-default-logging-driver), which performs no log rotation by default. As a result of this lack of rotation, log files stored by the `json-file` driver can consume a significant amount of disk space for containers that generate a lot of output. This can lead to disk space exhaustion. To address this, use [journald](https://docs.docker.com/config/containers/logging/journald/) as the logging driver when available, or [another supported driver](https://docs.docker.com/config/containers/logging/configure/#supported-logging-drivers) with native rotation support.