Gitlab / Docker tricks
Recently some changes were made in the Gitlab / Gitlab-runner docker images, cause some issues, and I got below workaround:
1. Gitlab docker was listening on tcp port, but client can't connect to this port and telnet will also be closed immediately.
Solution: Add parameter hostname inthe docker start command, like:
docker run --detach \
--hostname your.host.name.or.ip \
--publish 2443:2443 \
--publish 2080:2080 \
--publish 2022:2022 \
--restart always \
-e "GITLAB_SHELL_SSH_PORT=2022" \
-e "GITLAB_SSH_PORT=2022" \
--name gitlab \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
2. Gitlab can't find LDAP Auth server:
Workaround:
Use LDAP Server IP address.
3. Gitlab runner pipeline didn't work, the error is like:
ERROR: Build failed (system failure): Get http://unix.sock/v1.18/version: dial unix /var/run/docker.sock: connect: no such file or directory
Solution:
The official document is not complete, below volume /var/run is also needed:
docker run -d --name gitlab-runner --restart always \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest