sharevb/docker-image-download-server

By sharevb

Updated 4 days ago

Node server to pull and save Docker images with platform and registry auth support

Image
Networking
0

4.2K

sharevb/docker-image-download-server repository overview

Docker Image Download Service

A lightweight Node.js HTTP service that lets clients pull, save, and download Docker images on demand.
It supports:

  • Multi‑platform pulls (linux/amd64, linux/arm64, etc.)
  • Private registry authentication
  • Streaming .tar downloads
  • Running inside a container with access to the host Docker daemon

This service is ideal for CI pipelines, air‑gapped deployments, offline registries, or tooling that needs to export Docker images programmatically.

Features

✔ Pull Docker images

Uses docker pull with optional --platform.

✔ Save images as tarballs

Uses docker save and streams the result directly to the client.

✔ Registry authentication

Supports:

  • Username/password
  • Optional registry hostname
  • Automatic logout after the request

Requirements

  • Docker installed on the host
  • Node.js 18+ or 20+
  • If running inside Docker:
    mount the host Docker socket
    -v /var/run/docker.sock:/var/run/docker.sock
    

Environment Variables

VariableDefaultDescription
HOST0.0.0.0Interface to bind the HTTP server
PORT3000Port to listen on
CORS*CORS Allowed Origins

API

GET /download

Downloads a Docker image as a .tar file.

Query parameters
NameRequiredDescription
imageyesImage name, e.g. alpine:latest
platformnoDocker platform, e.g. linux/arm64
registrynoRegistry hostname for login
usernamenoRegistry username
passwordnoRegistry password
Example: public image
curl -O -J "http://localhost:3000/download?image=alpine:latest"
Example: multi‑arch image
curl -O -J "http://localhost:3000/download?image=nginx:latest&platform=linux/arm64"
Example: private registry
curl -O -J \
  "http://localhost:3000/download?image=myregistry.com/app:1.2.3&platform=linux/amd64&registry=myregistry.com&username=alice&password=secret"

Running Locally

Install dependencies:

npm install

Start the server:

HOST=127.0.0.1 PORT=3000 node server.js

Running in Docker

Pull latest image:

docker pull sharevb/docker-image-download-server:latest

Run it with access to the host Docker daemon:

docker run \
  -p 3000:3000 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  sharevb/docker-image-download-server:latest

Security Notes

  • If using registry credentials, prefer short‑lived tokens.
  • Use HTTPS or a reverse proxy if exposing the service publicly.

License

MIT

Tag summary

Content type

Image

Digest

sha256:d1a5ffa50

Size

131.9 MB

Last updated

4 days ago

docker pull sharevb/docker-image-download-server:adbd7b9c35065713a40181c670fde90fa99d562c