Preparations:

  • Docker Engine
  • Docker Compose

Folder structure will be like this:

├── docker-compose.yml
├── registry_data/
└── config/
    └── config.yml

Create docker-compose.yml

services:
  registry:
    image: registry:2
    container_name: container-private-reg
    ports:
      - "5000:5000"
    environment:
      REGISTRY_HTTP_ADDR: :5000
      # REGISTRY_HTTP_TLS_CERTIFICATE: /certs/cert.crt
      # REGISTRY_HTTP_TLS_KEY: /certs/cert.key
      REGISTRY_STORAGE: filesystem
      REGISTRY_STORAGE_DELETE_ENABLED: 'true'
      REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /var/lib/registry
      REGISTRY_HTTP_SECRET: "sometHingLiker4nd0m-secR3et#eY"
    volumes:
      - ./registry_data:/var/lib/registry
      - ./config/config.yml:/etc/docker/registry/config.yml
    restart: always

  registry-ui:
    image: joxit/docker-registry-ui:latest
    container_name: container-private-reg-ui
    ports:
      - "8280:80"
    environment:
      - REGISTRY_TITLE="My - Docker Registry"
      - REGISTRY_URL=https://registry.your-domain.id/docker # http://127.0.0.1:5000 # use IP if no proxy nginx
      - DELETE_IMAGES=true  # Allows deletion of images through the UI
      - SINGLE_REGISTRY=true
    depends_on:
      - registry
    restart: always

volumes:
  registry_data:

Create config/config.yml

Inside folder config, create config.yml

version: 0.1
log:
  fields:
    service: registry
storage:
  filesystem:
    rootdirectory: /var/lib/registry
http:
  headers:
    Access-Control-Allow-Origin: ['*']
    Access-Control-Allow-Methods: ['HEAD', 'GET', 'OPTIONS', 'DELETE']
    Access-Control-Allow-Headers: ['Authorization', 'Accept', 'Cache-Control', 'Content-Type', 'X-Requested-With', 'Docker-Content-Digest']
    Access-Control-Expose-Headers: ['Docker-Content-Digest']

Build

docker-compose up -d –build

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *