Running Your Own Gitlab On Docker - Community Edition

The Easy Part

FROM debian:10.1LABEL author=”m4dm0nk3y.za@gmail.com”
RUN apt-get update &&
apt-get install -y xterm curl openssh-server ca-certificates postfix
RUN curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | bash
RUN apt-get install -y gitlab-ce
EXPOSE 22 80 443
ENTRYPOINT gitlab-ctl reconfigure
ENTRYPOINT gitlab-ctl reconfigure && tail -f /dev/null
docker build -t gitlab-ce12.4.0 ./ && docker run -itd --restart=on-failure -p 8080:80 -p 8022:22 -p 8443:443 gitlab-ce12.4.0

Dealing with Errors

So now that you have everything all setup you are of course ready to read errors. The errors I faced will luckily be gracefully handled in this guide

Error 1

Firstly unless you have run the container with the privileged flag you can expect to see this:

Error executing action ‘run’ on resource ‘execute[load systl conf kernel.shmmax]’
docker build -t gitlab-ce12.4.0 ./ && docker run -itd --restart=on-failure -p 8080:80 -p 8022:22 -p 8443:443 --privileged gitlab-ce12.4.0

Error 2

You may also be faced with your Gitlab hanging on this output:

“ruby_block[wait for redis service socket] action run”

This is due to an issue which you can read about here..

ENTRYPOINT (/opt/gitlab/embedded/bin/runsvdir-start &) && \
gitlab-ctl reconfigure

Config:

Grafana Hanging

“ruby_block[authorize Grafana with GitLab] action run”

Grafana is is used to monitor things happening on GitLab, but it can take an eternity to authorize, and sometimes it down right refuses to initialize properly.

RUN sed -i "s/# grafana\['enable'\] = true/grafana['enable'] = false/g" /etc/gitlab/gitlab.rb

$TERM not set

Environment variable: TERM has not been set
ENV TERM=xtermRUN apt-get update && ...

Error 502

Whoops, GitLab is taking too much time to respond.
RUN sed -i "s/unicorn\['worker_timeout'\] = 60/unicorn\['worker_timeout'\] = 300/g" /etc/gitlab/gitlab.rb

Slow Startup Time

docker run --name gitlab-ce12.4.0 -itd --shm-size=4g --restart=on-failure  -p 8080:80 -p 8022:22 -p 8443:443 --privileged gitlab-ce12.4.0

SUCCESS!

This is what victory looks like

Other Errors:

Prometheus Monitor Hanging

RUN sed -i "s/prometheus_monitoring\['enable'\] = false/prometheus_monitoring\['enable'\] = true/g" /etc/gitlab/gitlab.rb

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cornelis Terblanche

Cornelis Terblanche

5 Followers

Robotics & Automation enthusiast, with a brief history of working in the software development sector. A large passion for entrepreneurship and open sourcing.