Show HN: Self-hosted Docker image registry. One container, two simple accounts

Hacker News by 4 min read 72x views
Show HN: Self-hosted Docker image registry. One container, two simple accounts

Share Post

Registreasy β€” self-hosted Docker depiction register alongside shove and drag users

  • One container, one port, one data folder. Back up ./data and keep your deployment configuration and credentials alongside it.
  • Simple users that equivalent how you work. Two accounts, and exactly that much.
  • See what you have. A web leaf lists tagged images by repository and previews deletes before you confirm.
Account Can do
πŸ”‘ push Read images, publish images, delete tags in the web page
πŸ‘€ pull Read images only. Leave PULL_PASSWORD unset to skip it and authorize anonymous pulls

Built on the CNCF Distribution register rearward Nginx. Works alongside plain docker login, push, drag and Compose.

docker-compose.yml:

services: registreasy: image: ghcr.io/dellarb/registreasy:latest restart: unless-stopped ports: - "${BIND_ADDRESS:-127.0.0.1}:${PORT:-5000}:5000" environment: PUSH_PASSWORD: "replace-with-a-long-random-push-password" PULL_PASSWORD: "replace-with-a-long-random-pull-password" # omit to authorize pulls alongside no password volumes: - ./data:/data

Replace all example password alongside a distinct random secret.

The quick commencement binds to 127.0.0.1, so lone clients on the register presenter can connect. For pulls and pushes from another device on a trusted LAN or VPN, set BIND_ADDRESS in the Compose project's .env to the register host's LAN or VPN IP (for example, 192.168.1.10) and run docker create up -d. Set PORT in the identical document if you desire a presenter harbor another than 5000. Use that IP and harbor on the client. With plain HTTP, add the endpoint to the client's Docker insecure-registries environment and restart Docker. Only the shove document can publish.

docker drag alpine:3.22 docker tag alpine:3.22 localhost:5000/example/alpine:demo docker login localhost:5000 -u push docker shove localhost:5000/example/alpine:demo docker logout localhost:5000 docker depiction rm localhost:5000/example/alpine:demo # Omit this login whenever PULL_PASSWORD is unset. docker login localhost:5000 -u pull docker drag localhost:5000/example/alpine:demo

Docker keeps one login per hostname, so a docker login -u shove and a docker login -u drag overwrite all other. Pushing needs the shove login; pulling needs whichever document your PULL_PASSWORD environment requires.

Replace localhost:5000 alongside your presenter and port. Images are stored under the repository name you choose, current example/alpine.

Open the web inventory http://[yourhost]:5000 and sign in. The drag document provides a read-only perspective whenever configured. The shove document can preview and verify tagged-image deletes.

Routine deletes depart the register online. In Settings, the shove person can run offline refuse gathering on petition or allow a regular window. See maintenance and recovery for downtime, backups, and rollback. The registry-size cardstock measures the on-disk total automatically whenever you open the inventory.

Telemetry is optional and off until a signed-in person opts in (banner or Settings β†’ Privacy & Telemetry); there is additionally a Feedback button. It is pseudonymous facility telemetry: counts and error categories only, never depiction names, tags or users, and you can preview exactly what all choice sends and rotate it off at any time. See telemetry, privacy and feedback.

The Registreasy web inventory, showing repositories, tags, sizes and build dates

HTTPS. By default, plain HTTP is accepted lone from personal addresses (loopback, 10/8, 172.16/12, 192.168/16, 169.254/16, 100.64/10 and IPv6 ULA/link-local). Keep plain HTTP on a trusted LAN or VPN. For item public, put a TLS proxy in front, tie the register harbor to loopback, set REQUIRE_HTTPS=1, and item TRUSTED_PROXY at the proxy's IP so the forwarded client location and scheme are trusted. /healthz remains accessible complete plain HTTP for monitors, including whenever REQUIRE_HTTPS=1.

Pull without a password. Leave PULL_PASSWORD unset or empty. Anyone who reaches the harbor can drag all image. Writes and the web leaf motionless need a sign-in. Use it lone on a LAN or VPN, or rearward HTTPS alongside suitable admission controls.

Configuration.

Variable Default Meaning
PUSH_PASSWORD required Push person password
PULL_PASSWORD unset (anonymous pulls) Pull person password; set it to necessitate authenticated pulls
PUSH_USERNAME / PULL_USERNAME push / pull Account names (must differ)
BIND_ADDRESS / PORT 127.0.0.1 / 5000 Compose presenter tie location and published port
REQUIRE_HTTPS 0 Require HTTPS apart from for health checks
TRUSTED_PROXY unset IP location of the TLS proxy
TZ UTC Default IANA timezone for scheduled refuse collection; a timezone saved in Settings takes precedence
GC_DRAIN_SECONDS / GC_TIMEOUT_SECONDS 30 / 900 Seconds allowed for all drain delay and for collection, respectively
SESSION_IDLE_SECONDS / SESSION_MAX_SECONDS 1800 / 43200 Web sign-in limits

Build from source. git copy https://github.com/dellarb/registreasy.git, set PUSH_PASSWORD in .env and optionally PULL_PASSWORD to necessitate authenticated pulls, afterward docker create up -d --build.

Pull requests welcome; see CONTRIBUTING.md. Report vulnerabilities via SECURITY.md. Licensed under the AGPL-3.0; operating the unmodified depiction has no additional obligations.

Other Article Hacker News
↑
Close Right Ads
Close Left Ads