ℹ️ Run the installation on a brand new host without any previous services running on ports 22, 80 nor 443 ℹ️
🐳 Tested using Docker Desktop 4.4.4 (73704).
[1/1] Add this line to the hosts file:
127.0.0.1 gitlab
[1/1] Create a network for our conatiners to communicate between each others:
docker network create gitlab-network
[1/4] Set GITLAB_HOME env:
export GITLAB_HOME=/srv/gitlab
[2/4] Run GitLab Community Edition:
sudo docker run --detach --hostname gitlab --network gitlab-network --publish 443:443 --publish 80:80 --publish 22:22 --name gitlab --restart always --volume $GITLAB_HOME/config:/etc/gitlab --volume $GITLAB_HOME/logs:/var/log/gitlab --volume $GITLAB_HOME/data:/var/opt/gitlab --shm-size 256m gitlab/gitlab-ce:latest
⏳ The previous step (step C.2) can take a while (several minutes)... Look at container logs to see the progression.
docker logs -f gitlab
[3/4] Get temporary root password:
sudo docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password
[4/4] Login with username "root" and password as above (step C.3) at http://127.0.0.1
[1/6] Start the runner container:
docker run -d --name gitlab-runner --network gitlab-network --restart always -v /srv/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest
[2/6] Register a runner (if you execute n times this command, it will register n runners):
docker run --rm -it --network gitlab-network -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register
[3/6] Follow steps:
- Host : http://gitlab
- Go to http://127.0.0.1/admin/runners to get runner's token
- Description
- Tag
- Executor : docker
- Default image : ruby:2.6
[4/6] Activate "Run untagged jobs" (ex.: http://127.0.0.1/admin/runners/1/edit but do it on each one)
[5/6] Open runner's configuration file:
sudo vim /srv/gitlab-runner/config/config.toml
[6/6] Under [runners.docker] section, add the following (otherwise, the runner cannot resolve http://gitlab/...):
privileged = true
network_mode = "gitlab-network"