Update docker-compose.yml
Add these lines to enable and expose the registry.
gitlab_rails['registry_enabled'] = true
registry_external_url 'http://localhost:5001'
Restart Containers
Run docker compose up --build --force-recreate
- Login to GitLab: Create a new repository and access the Container Registry section.
- Add a Dockerfile to the project root for testing purposes.
- Register a GitLab Runner as a Docker executor (if not done already).
- Setup
gitlab-ci.yml
Pipeline:This pipeline logs into the registry, builds the Docker image, tags it, and pushes it to GitLab’s Container Registry.build: stage: build image: docker:latest tags: - docker script: - echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin - docker build -t "$CI_REGISTRY_IMAGE:${CI_COMMIT_SHA:0:8}" . - docker push "$CI_REGISTRY_IMAGE:${CI_COMMIT_SHA:0:8}"
- Copy the Image Path from the registry and run:
docker pull localhost:5001/root/build-with-lal:<tag>
- Authenticate if Needed:
docker login --username <user> --password <password> localhost:5001
- File System (default):
registry_path
can be customized ingitlab.rb
. - Other Options: Azure, Google Cloud Storage, and S3.
- Third-Party Registries are no longer supported as of GitLab 16.0.
- Registry Authentication: GitLab manages authentication for secure image access.