Table of Contents

Setting up Gitlab with Docker on Ubuntu Server

Install Ubuntu Server

Choose from the official ubuntu website.

Here : 16.04.1 Long Term Support (LTS)

Install Docker

Follow the guidelines from the official website

Install GitLab

Use the pull command as described on the docker website

Remark : sudo should be used here as sudo https://hub.docker.com/r/gitlab/gitlab-ce/

Then, run gitlab from docker :

(use -i to display startup logs or –detach for a silent startup)

sudo docker run -i \
    --hostname local.ngen.gitlab.be \
    --env GITLAB_OMNIBUS_CONFIG="external_url 'http://local.ngen.gitlab.be'; gitlab_rails['lfs_enabled'] = true;" \
    --publish 10443:443 --publish 10080:80 --publish 10022:22 \
    --name gitlab \
    --restart always \
    --volume /srv/gitlab/config:/etc/gitlab \
    --volume /srv/gitlab/logs:/var/log/gitlab \
    --volume /srv/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:latest

Personal experience :

When starting up using -i, I noticed this output :

seb@ubuntu:~$ sudo docker run -i \

...

If this container fails to start due to permission problems try to fix it by executing:

  docker exec -it gitlab update-permissions
  docker restart gitlab

Preparing services...
Starting services...
Configuring GitLab package...
/opt/gitlab/embedded/bin/runsvdir-start: line 24: ulimit: pending signals: cannot modify limit: Operation not permitted
/opt/gitlab/embedded/bin/runsvdir-start: line 37: /proc/sys/fs/file-max: Read-only file system
Configuring GitLab...
gitlab Reconfigured!

Therefore I ran those commands :

docker exec -it gitlab update-permissions
docker restart gitlab

How to inspect which container is running ?

sudo docker ps

OUTPUT HERE…

How to inspect existing containers :

docker ps -a

OUTPUT HERE…

If you need to remove a container

docker rm drunk_fermi

or forcefully using,

docker rm -f drunk_fermi

Configure GitLab

Access the GitLab shell

sudo docker exec -it gitlab /bin/bash

Access directly the main config file

sudo docker exec -it gitlab /bin/bash