Skip to content

CNCF Distribution deployment

yaml
name: cncf_distribution_stack
services:
  registry-server:
    restart: always
    image: docker.io/library/registry:3
    ports:
      - 5000:5000
    environment:
      REGISTRY_STORAGE_DELETE_ENABLED: "true"
      REGISTRY_AUTH: htpasswd
      REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
      REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
    volumes:
      - ./registry/data:/var/lib/registry
      - ./registry/auth:/auth
    networks: registry-net

  registry-ui:
    image: docker.io/joxit/docker-registry-ui:latest
    ports:
      - 8080:80
    environment:
      - SINGLE_REGISTRY=true
      - REGISTRY_TITLE=My Registry
      - DELETE_IMAGES=true
      - SHOW_CONTENT_DIGEST=true
      - NGINX_PROXY_PASS_URL=http://registry-server:5000
      - SHOW_CATALOG_NB_TAGS=true
      - CATALOG_MIN_BRANCHES=1
      - CATALOG_MAX_BRANCHES=1
      - TAGLIST_PAGE_SIZE=100
      - REGISTRY_SECURED=true
      - CATALOG_ELEMENTS_LIMIT=1000
      - REGISTRY_URL=http://192.168.11.110:8080
    container_name: registry-ui
    depends_on:
      - registry-server
    networks:
      - registry-net

networks:
  registry-net:
    driver: bridge

Start

sh
  podman-compose up -d

Usage

Login

On Clients:

sh
  sudo vim /etc/containers/registries.conf.d/local_registry.conf

  [[registry]]
  location = "192.168.1.110:5000"
  insecure = true

  podman login 192.168.1.110:5000 -u <username> -p <password>

Pushing images

sh
  podman pull alpine
  podman push 192.168.1.110:5000/alpine:latest

Pulling images

sh
  podman pull 192.168.1.110:5000/alpine:latest

Update/create User

On server, you can update or add user using:

sh
  podman run --rm \
    -v $(pwd)/registry/auth:/auth \
    docker.io/library/httpd:2 \
    htpasswd -Bb /auth/htpasswd <username> <newpassword>

On clients:

sh
  podman logout --all
  podman login 192.168.1.110:5000 -u <username> -p <newpassword>

Remove user

sh
  podman run --rm \
    -v $(pwd)/registry/auth:/auth \
    docker.io/library/httpd:2 \
    htpasswd -D /auth/htpasswd <username>

  cat ./registry/auth/htpasswd