Skip to content
Yacn9Public

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚢 Dockfetch

A small CLI tool to pull Docker images (with proxy support), optionally retag them, and export them as tar files for offline environments.


✨ Features

  • Pull multiple Docker images
  • Temporary Docker daemon proxy support
  • Mirror registry support (e.g. arvancloud)
  • Automatic retagging to canonical image names
  • Export images as .tar (for offline transfer)
  • Safe (no prune / no destructive operations)

🚀 Installation

go build -o dockfetch ./cmd

📦 Usage

Pull a single image

./dockfetch --image nginx:latest

Pull multiple images

./dockfetch \
 --image nginx:latest \
 --image redis:7 \
 --image postgres:16

Use proxy (for restricted networks)

./dockfetch \
 --image nginx \
 --proxy http://127.0.0.1:7890

Export images (offline usage)

./dockfetch \
 --image nginx \
 --save \
 --output-dir ./exports

Mirror + Retag (important for Iran / restricted regions)

./dockfetch \
 --image docker.arvancloud.ir/nginx:latest \
 --retag-mirror \
 --save
  • ✔ Pulls from mirror
  • ✔ Retags to nginx:latest
  • ✔ Saves as tar

🔄 Load on offline server

docker load -i nginx_latest.tar

⚙️ Flags

Flag Description

  • --image Docker image (repeatable)
  • --proxy HTTP proxy for Docker daemon
  • --https-proxy HTTPS proxy (optional)
  • --no-proxy NO_PROXY value
  • --save Export image to tar
  • --output-dir Output directory
  • --retag-mirror Retag mirror images
  • --mirror-prefix Mirror prefix (repeatable)
  • --keep-proxy Do not remove proxy after run
  • --list-before Show images before
  • --list-after Show images after

🧠 How It Works

1. CLI (internal/cli)

Parses flags and prepares configuration.

2. Planner (internal/planner)

Transforms user input into an execution plan:

  • what to pull
  • how to tag
  • where to save 3. Docker Layer (internal/docker)

Handles:

  • docker pull
  • docker tag
  • docker save
  • docker images 4. Proxy Layer (internal/proxy)

Temporarily configures Docker daemon proxy using systemd:

  • applies proxy before pull
  • removes proxy after execution 5. Utils (internal/util)

🧩 Design Principles

  • Thin main.go (orchestration only)
  • Separation of concerns
  • Plan → Execute pattern
  • Safe defaults (no destructive commands)
  • Extensible architecture

🔮 Future Improvements

  • Parallel image pulls
  • Progress bars (Docker-like UI)
  • Retry mechanism
  • Compression (tar.gz)
  • GUI interface

⚠️ Notes

  • Requires Docker installed
  • Proxy changes affect Docker daemon (system-wide)
  • Needs sudo for proxy operations

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages