## Choosing between the single and the app and data images
This will start GitLab CE container and expose ports needed to access SSH, HTTP and HTTPS.
All GitLab data will be stored as subdirectories of `/srv/gitlab/`.
The container will automatically `restart` after system reboot.
Normally docker uses a single image for one applications.
But GitLab stores repositories and uploads in the filesystem.
This means that upgrades of a single image are hard.
That is why we recommend using separate app and data images.
We'll first describe how to use a single image.
After that we'll describe how to use the app and data images.
After this you can login to the web interface as explained above in 'After starting a container'.
## Single image
## Build and publish the image
Get a published image from Dockerhub:
This guide will also let you know how to build docker image yourself.
Please run all the commands from the GitLab repo root directory.
People using boot2docker should run all the commands without sudo.
```bash
sudo docker pull sytse/gitlab-ce:7.10.1
sudo docker build --tag gitlab/gitlab-ce:latest
```
Run the image:
## Where is the data stored?
```bash
sudo docker run --detach--publish 8080:80 --publish 2222:22 sytse/gitlab-ce:7.10.1
```
The GitLab container uses host mounted volumes to store persistent data:
-`/srv/gitlab/data` mounted as `/var/opt/gitlab` in the container is used for storing *application data*
-`/srv/gitlab/logs` mounted as `/var/log/gitlab` in the container is used for storing *logs*
-`/srv/gitlab/config` mounted as `/etc/gitlab` in the container is used for storing *configuration*
After this you can login to the web interface as explained above in 'After starting a container'.
You can fine tune these directories to meet your requirements.
### Configure GitLab
Build the image:
This container uses the official Omnibus GitLab distribution, so all configuration is done in the unique configuration file `/etc/gitlab/gitlab.rb`.
To access GitLab configuration, you can start an bash in a new the context of running container, you will be able to browse all directories and use your favorite text editor:
sudo docker exec-it gitlab vi /etc/gitlab/gitlab.rb
```
Diagnosing commands:
**You should set the `external_url` to point to a valid URL.**
**To receive e-mails from GitLab you have to configure the [SMTP settings](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md),
because Docker image doesn't have a SMTP server.**
**Note** that GitLab will reconfigure itself **at each container start.** You will need to restart the container to reconfigure your GitLab:
For more options for configuring the container please check [Omnibus GitLab documentation](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#configuration).
### Get published images from Dockerhub
## Diagnose potential problems
Read container logs:
```bash
sudo docker pull sytse/gitlab-data
sudo docker pull sytse/gitlab-app:7.10.1
sudo docker logs gitlab
```
### Run the images
Enter running container:
```bash
sudo docker run --name gitlab-data sytse/gitlab-data /bin/true
After this you can login to the web interface as explained above in 'After starting a container'.
From within container you can administrer GitLab container as you would normally administer Omnibus installation: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md.
### Build images
Build your own based on the Omnibus packages with the following commands.
We assume using a data volume container, this will simplify migrations and backups.
This empty container will exist to persist as volumes the 3 directories used by GitLab, so remember not to delete it.
The directories on data container are:
-`/var/opt/gitlab` for application data
-`/var/log/gitlab` for logs
-`/etc/gitlab` for configuration
### Configure GitLab
This container uses the official Omnibus GitLab distribution, so all configuration is done in the unique configuration file `/etc/gitlab/gitlab.rb`.
To access GitLab configuration, you can start an interactive command line in a new container using the shared data volume container, you will be able to browse the 3 directories and use your favorite text editor:
1. remove existing container,
```bash
sudo docker pull gitlab/gitlab-ce:latest
```
1. create the container once again with previously specified options.
```bash
sudo docker run -ti-eTERM=linux --rm--volumes-from gitlab-data ubuntu
**Note** that GitLab will reconfigure itself **at each container start.** You will need to restart the container to reconfigure your GitLab.
On the first run GitLab will reconfigure and update itself.
You can find all available options in [Omnibus GitLab documentation](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#configuration).
### Run GitLab CE on public IP address
### Upgrade GitLab with app and data images
You can make Docker to use your IP address and forward all traffic to the GitLab CE container.
You can do that by modifying the `--publish` ((Binding container ports to the host)[https://docs.docker.com/articles/networking/#binding-ports]):
To upgrade GitLab to new versions, stop running container, create new docker image and container from that image.
> --publish=[] : Publish a container᾿s port or a range of ports to the host format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort
It Assumes that you're upgrading from 7.8.1 to 7.10.1 and you're in the updated GitLab repo root directory: