Setup GitLab Docker Registry


Run in a docker container, behind Traefik.

Add the following to the docker-compose YAML in


                registry_external_url ''
                registry['enable'] = true
                registry_nginx['listen_port'] = 81
                registry_nginx['listen_https'] = false
                registry_nginx['real_ip_trusted_addresses'] = [ '' ]
                registry_nginx['real_ip_header'] = 'X-Forwarded-For'
                registry_nginx['request_buffering_off_path_regex'] = '.?'



            traefik.enable: 'true'

            traefik.gitlab.port: '80'
            traefik.gitlab.frontend.rule: 'Host:'

            traefik.registry.port: '81'
            traefik.registry.frontend.rule: 'Host:'


Important Notes

  • /var/opt/gitlab/gitlab-rails/shared/registry/docker
    • The docker images are stored here...
    • Their paths are not hashed like git repositories (which apparently means a project with docker images cannot be moved without deleting them first...)


Pushes Fail

If you see docker push failing with immediate "Retrying in 5 seconds" messages, and HTTP 500 responses in the logs, then make sure that the /var/opt/gitlab/gitlab-rails/shared/registry/docker directory is owned by UID 993, with permissions of at least 0755.