Skip to content

Installation

Kyle Mendell edited this page Apr 4, 2025 · 8 revisions

Prerequisites

The main requirement to use Svelocker is a distribution/registry container setup.

Note that you need to add the below env variables to the Registry container.

REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin: '[https://svelocker.example.com]'
REGISTRY_HTTP_HEADERS_Access-Control-Allow-Methods: '[HEAD,GET,OPTIONS,DELETE]'
REGISTRY_HTTP_HEADERS_Access-Control-Allow-Credentials: '[true]'
REGISTRY_HTTP_HEADERS_Access-Control-Allow-Headers: '[Authorization,Accept,Cache-Control]'
REGISTRY_HTTP_HEADERS_Access-Control-Expose-Headers: '[Docker-Content-Digest]'

Important

You can replace the Access-Control-Allow-Origin line to this REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin: '["*"]' lto allow traffic from all origins but this is not recommended.

Below is a full example of a registry container compose file:

services:
  registry:
    image: registry:3
    container_name: registry
    environment:
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin: '[https://svelocker.example.com]'
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Methods: '[HEAD,GET,OPTIONS,DELETE]'
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Credentials: '[true]'
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Headers: '[Authorization,Accept,Cache-Control]'
      REGISTRY_HTTP_HEADERS_Access-Control-Expose-Headers: '[Docker-Content-Digest]'
    ports:
      - 5000:5000
    volumes:
      # Mount the password file
      - /opt/docker/registry/registry.password:/auth/registry.password
      # Mount the data directory
      - /opt/docker/registry/data:/data
      - /opt/docker/registry/ssl:/certs

Svelocker Install

The easiest way to setup Svelocker is to use docker compose. Below is a Example compose.yaml file:

services:
  svelocker-ui:
    image: ghcr.io/ofkm/svelocker-ui:latest
    restart: unless-stopped
    env_file: .env
    ports:
      - 3000:3000
    volumes:
      - ./data:/app/data
    # Optional healthcheck
    healthcheck:
      test: 'curl -f http://localhost:3000/health'
      interval: 1m30s
      timeout: 5s
      retries: 2
      start_period: 10s

You will also need to add the .env file. Below is a example of a .env file:

# Registry Settings
PUBLIC_REGISTRY_URL=https://registry.example.com # Registry URL
PUBLIC_REGISTRY_NAME=My Docker Registry          # Display name
PUBLIC_API_URL=http://localhost:3000             # Public URL Svelocker will run on
PUBLIC_REGISTRY_USERNAME=username                # Username for registry if basic auth is enabled
PUBLIC_REGISTRY_PASSWORD=password                # Password for registry if basic auth is enabled


# Database
DB_PATH=data/svelockerui.db                      # SQLite database path inside container

#App Settings
PUBLIC_LOG_LEVEL=WARN                            # Set the log level (TRACE, DEBUG, INFO, WARN, ERROR)

Start the container:

docker compose up -d

You should now be able to access Svelocker at: http://localhost:3000

Important

Note if your registry is secured by HTTPS then Svelocker UI need to be secured by HTTPS as well.

Clone this wiki locally