Search code examples
dockergitlabdebiandocker-registry

Enable "Gitlab registry" on a personnal gitlab build with docker-compose.yml


Hello I started learn container, docker, etc since last week and I have a question.

I created a gitlab-ee container with the image available on the dockerhub, docker-ee version : 12.6.4

I used a docker-compose.yaml to add the volumes and keep my modifications.

But when I go on my gitlab web interface I don’t see the “registry” section and I can’t enable it in the settings …

Here my docker-compose.yaml :

version: '3'
services:
    registry:
        container_name: registry
        restart: always
        image: registry:latest
        ports:
        - 5000:5000
        environment:
             REGISTRY_HTTP_TLS_CERTIFICATE: /certs/domain.crt
             REGISTRY_HTTP_TLS_KEY: /certs/domain.key
             REGISTRY_AUTH: htpasswd
             REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
             REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
        volumes:
        - /home/test_docker/registry/volumes/data:/var/lib/registry
        - /home/test_docker/registry/volumes/certs:/certs
        - /home/test_docker/registry/volumes/auth:/auth

    gitlab-ee:
        depends_on : 
        - registry
        container_name: gitlab-ee
        image: gitlab/gitlab-ee
        volumes:
        - /home/test_docker/gitlab_ee/volumes/config:/etc/gitlab
        - /home/test_docker/gitlab_ee/volumes/logs:/var/log/gitlab
        - /home/test_docker/gitlab_ee/volumes/data:/var/opt/gitlab
        hostname :  gitlab.example.com
        restart: always
        ports:
        - "80:80"
        - "443:443"
        - "8082:22"
        - "5050:5050"

Here the modification I did in gitlab.yml :

registry:
  enabled: true
  host: registry.gitlab.example.com
  port: 5005
  api_url: http://localhost:5000/
  key: config/registry.key
  path: shared/registry
  issuer: gitlab-issuer

I also modify the /etc/gitlab/gitlab.rb by uncommenting the line :

gitlab_rails['gitlab_default_projects_features_container_registry'] = true

But I still doesn't have the access to "Gitlab registry" in my Gitlab web interface and also in the settings, I also notice that after a restart of the gitlab container the gitlab.yml is re writed and the modifications disapeard but however I created my volumes in the docker-compose.yaml ...

So please if somebody can help me ..

Best regards,


Solution

  • The registry is not part of Gitlab. You need to deploy different container for registry and the details of that will be put in gitlab.rb file.

    open your gitlab.rb file and check default valuesfor the registry.

    Check this Gitlab Registry