Skip to content

Instantly share code, notes, and snippets.

@giathinh910
Last active May 6, 2024 09:32
Show Gist options
  • Save giathinh910/d09bd3a0e05af04c41578d60faba48aa to your computer and use it in GitHub Desktop.
Save giathinh910/d09bd3a0e05af04c41578d60faba48aa to your computer and use it in GitHub Desktop.
Setup Docker registry

Registry using Docker container

# docker-compose.yml
services:
  docker-registry:
    restart: always
    image: registry:2
    ports:
    - "5000:5000"
    environment:
      REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
      REGISTRY_AUTH: htpasswd
      REGISTRY_AUTH_HTPASSWD_REALM: "Registry Realm"
      REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
      REGISTRY_STORAGE_DELETE_ENABLED: true
    volumes:
      - ./data:/data
      - ./auth:/auth

Generate Basic Auth

sudo apt install apache2-utils
mkdir auth
sudo htpasswd -cB auth/htpasswd your-username

Run and test

docker-compose up -d
curl -u your-username -X GET http\://localhost:5000/v2/_catalog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment