docker-image-pusher 0.2.2

High-performance command-line tool for pushing Docker image tar packages directly to Docker registries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
# Docker Image Pusher v0.2.0

[![Build Status](https://github.com/yorelog/docker-image-pusher/workflows/Build%20and%20Test/badge.svg)](https://github.com/yorelog/docker-image-pusher/actions)
[![Crates.io](https://img.shields.io/crates/v/docker-image-pusher.svg)](https://crates.io/crates/docker-image-pusher)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Downloads](https://img.shields.io/crates/d/docker-image-pusher.svg)](https://crates.io/crates/docker-image-pusher)

A **high-performance command-line tool** written in Rust for pushing Docker image tar packages directly to Docker registries. **Version 0.2.2** represents a major architectural refactoring with modernized naming conventions, simplified module structure, and improved error handling.

## [πŸ‡¨πŸ‡³ δΈ­ζ–‡ζ–‡ζ‘£]README_zh.md

## ✨ NEW in v0.2.0 - Architecture Improvements

### πŸ—οΈ **Modernized Architecture**
- **Unified Registry Pipeline**: Consolidated upload/download operations into a single, efficient pipeline
- **Simplified Module Structure**: Removed redundant components and streamlined codebase
- **Modern Error Handling**: Renamed `PusherError` to `RegistryError` for better semantic clarity
- **Enhanced Logging**: Renamed output system to `logging` for clearer purpose

### 🧹 **Codebase Simplification**
- **Removed Legacy Code**: Eliminated redundant upload and network modules
- **Consolidated Operations**: Single `UnifiedPipeline` replaces multiple specialized components
- **Cleaner Imports**: Updated all module paths to reflect new structure
- **Better Maintainability**: Reduced complexity while maintaining all functionality

### πŸ”§ **Breaking Changes (v0.2.0)**
- **Module Restructuring**: `/src/output/` β†’ `/src/logging/`
- **Error Type Renaming**: `PusherError` β†’ `RegistryError`
- **Component Consolidation**: Unified pipeline architecture
- **API Modernization**: Cleaner, more intuitive function signatures

## ✨ Core Features

- **πŸš€ High Performance**: Streaming pipeline with priority-based scheduling
- **πŸ“¦ Large Image Support**: Optimized for large images with minimal memory usage
- **πŸ” Enterprise Security**: Comprehensive authentication support including token management
- **🌐 Multi-Registry**: Compatible with Docker Hub, Harbor, AWS ECR, Google GCR, Azure ACR
- **πŸ“Š Real-time Progress**: Advanced progress tracking with detailed metrics
- **πŸ›‘οΈ Intelligent Recovery**: Smart retry mechanisms with exponential backoff
- **βš™οΈ Advanced Configuration**: Fine-tuned control over streaming, concurrency, and memory usage
- **πŸ”„ Resume Support**: Resume interrupted uploads with layer-level precision
- **🎯 Dry Run Mode**: Validate configurations and test connectivity

## 🎯 Use Cases

### 🏒 **Enterprise & Production Environments**
- **πŸ”’ Air-Gapped Deployments**: Transfer massive ML models and applications to isolated networks
- **πŸ“‹ Security Compliance**: Meet data sovereignty requirements with on-premises registries
- **🌐 Edge Computing**: Deploy to remote locations with bandwidth constraints
- **πŸ”„ CI/CD Pipelines**: High-speed image transfers in automated deployment pipelines
- **πŸ’Ύ Disaster Recovery**: Efficient backup of critical container images

### 🧠 **AI/ML & Big Data**
- **πŸ€– Model Deployment**: Push large PyTorch/TensorFlow models efficiently
- **πŸ“Š Data Science**: Transfer images with large datasets and dependencies
- **πŸ”¬ Research Computing**: Distribute complex computational environments

## πŸ“₯ Installation

### Option 1: Download Pre-built Binary
Download from [GitHub Releases](https://github.com/yorelog/docker-image-pusher/releases):

```bash
# Linux x64
curl -L -o docker-image-pusher https://github.com/yorelog/docker-image-pusher/releases/latest/download/docker-image-pusher-x86_64-unknown-linux-gnu
chmod +x docker-image-pusher

# macOS Intel
curl -L -o docker-image-pusher https://github.com/yorelog/docker-image-pusher/releases/latest/download/docker-image-pusher-x86_64-apple-darwin
chmod +x docker-image-pusher

# macOS Apple Silicon  
curl -L -o docker-image-pusher https://github.com/yorelog/docker-image-pusher/releases/latest/download/docker-image-pusher-aarch64-apple-darwin
chmod +x docker-image-pusher

# Windows (PowerShell)
Invoke-WebRequest -Uri "https://github.com/yorelog/docker-image-pusher/releases/latest/download/docker-image-pusher-x86_64-pc-windows-msvc.exe" -OutFile "docker-image-pusher.exe"
```

### Option 2: Install via Cargo
```bash
cargo install docker-image-pusher
```

### Option 3: Build from Source
```bash
git clone https://github.com/yorelog/docker-image-pusher.git
cd docker-image-pusher
cargo build --release
# Binary will be at ./target/release/docker-image-pusher
```

## πŸš€ Quick Start

### **Basic Usage**
Simple, straightforward image pushing:

```bash
# Basic push with authentication
docker-image-pusher \
  --repository-url https://registry.example.com/project/app:v1.0 \
  --file /path/to/image.tar \
  --username myuser \
  --password mypassword \
  --verbose
```

### **Common Workflow**
```bash
# 1. Export image from Docker
docker save nginx:latest -o nginx.tar

# 2. Push to private registry
docker-image-pusher \
  -r https://harbor.company.com/library/nginx:latest \
  -f nginx.tar \
  -u admin \
  -p harbor_password \
  --verbose
```

### **Advanced Usage with Error Handling**
```bash
# Production-ready command with comprehensive error handling
docker-image-pusher \
  --repository-url https://enterprise-registry.com/production/app:v2.0 \
  --file /path/to/large-app.tar \
  --username production-user \
  --password $REGISTRY_PASSWORD \
  --timeout 3600 \
  --retry-attempts 5 \
  --skip-existing \
  --verbose
```

## πŸ“– Command Reference

### Core Arguments

| Short | Long | Description | Required | Example |
|-------|------|-------------|----------|---------|
| `-f` | `--file` | Docker image tar file path | βœ… | `/path/to/image.tar` |
| `-r` | `--repository-url` | Full repository URL | βœ… | `https://registry.com/app:v1.0` |
| `-u` | `--username` | Registry username | ⚠️ | `admin` |
| `-p` | `--password` | Registry password | ⚠️ | `secret123` |

### Configuration Options

| Short | Long | Description | Default | Example |
|-------|------|-------------|---------|---------|
| `-t` | `--timeout` | Network timeout (seconds) | `7200` | `3600` |
|  | `--large-layer-threshold` | Large layer threshold (bytes) | `1073741824` | `2147483648` |
|  | `--max-concurrent` | Maximum concurrent uploads | `1` | `4` |
|  | `--retry-attempts` | Number of retry attempts | `3` | `5` |

### Control Flags

| Long | Description | Usage |
|------|-------------|-------|
| `--skip-tls` | Skip TLS certificate verification | For self-signed certificates |
| `--verbose` | Enable detailed output | Debugging and monitoring |
| `--quiet` | Suppress all output except errors | Automated scripts |
| `--dry-run` | Validate without uploading | Configuration testing |
| `--skip-existing` | Skip uploading layers that already exist | Resume interrupted uploads |
| `--force-upload` | Force upload even if layers exist | Overwrite existing layers |

## 🏎️ Advanced Examples

### **Large Image Optimization**
```bash
# Optimized for large ML models (15GB PyTorch model)
docker-image-pusher \
  -r https://ml-registry.company.com/models/pytorch-model:v3.0 \
  -f large-model.tar \
  -u ml-engineer \
  -p $(cat ~/.ml-registry-token) \
  --large-layer-threshold 2147483648 \  # 2GB threshold for large layers
  --max-concurrent 4 \                  # 4 parallel uploads
  --timeout 7200 \                      # 2 hour timeout
  --retry-attempts 5 \                  # Extra retries for large uploads
  --verbose
```

### **Enterprise Harbor Registry**
```bash
# Production deployment to Harbor with comprehensive error handling
docker-image-pusher \
  -r https://harbor.company.com/production/webapp:v2.1.0 \
  -f webapp-v2.1.0.tar \
  -u prod-deployer \
  -p $HARBOR_PASSWORD \
  --skip-tls \               # For self-signed certificates
  --max-concurrent 2 \       # Conservative for production stability
  --skip-existing \          # Skip layers that already exist
  --retry-attempts 5 \       # Production-grade retry handling
  --verbose
```

### **Batch Processing Pipeline**
```bash
#!/bin/bash
# High-throughput batch processing with v0.2.0 error handling

REGISTRY="https://enterprise-registry.internal/data-science"
MAX_CONCURRENT=4
FAILED_IMAGES=()

for model_tar in models/*.tar; do
  model_name=$(basename "$model_tar" .tar)
  echo "πŸš€ Processing $model_name with v0.2.0 architecture..."
  
  if docker-image-pusher \
    -r "${REGISTRY}/${model_name}:latest" \
    -f "$model_tar" \
    -u "$DATA_SCIENCE_USER" \
    -p "$DATA_SCIENCE_TOKEN" \
    --max-concurrent $MAX_CONCURRENT \
    --large-layer-threshold 1073741824 \
    --timeout 3600 \
    --retry-attempts 3 \
    --skip-existing \
    --verbose; then
    echo "βœ… Successfully pushed $model_name"
  else
    echo "❌ Failed to push $model_name"
    FAILED_IMAGES+=("$model_name")
  fi
done

# Report batch results
if [ ${#FAILED_IMAGES[@]} -eq 0 ]; then
  echo "πŸŽ‰ All images processed successfully!"
else
  echo "⚠️  Failed images: ${FAILED_IMAGES[*]}"
  exit 1
fi
```

### **Edge Computing Deployment (Bandwidth Constrained)**
```bash
# Optimized for limited bandwidth environments
docker-image-pusher \
  -r https://edge-registry.factory.local/iot/sensor-hub:v2.1 \
  -f sensor-hub.tar \
  -u edge-deploy \
  -p $EDGE_PASSWORD \
  --max-concurrent 1 \               # Single connection for stability
  --large-layer-threshold 536870912 \ # 512MB threshold (smaller for edge)
  --timeout 3600 \                   # Extended timeout for slow networks
  --retry-attempts 10 \              # High retry count for unreliable networks
  --verbose
```

### **Multi-Architecture Deployment**
```bash
# Deploy multi-arch images efficiently with v0.2.0 skip-existing optimization
for arch in amd64 arm64 arm; do
  echo "πŸ—οΈ  Deploying $arch architecture..."
  docker-image-pusher \
    -r "https://registry.company.com/multiarch/webapp:v1.0-${arch}" \
    -f "webapp-${arch}.tar" \
    -u cicd-deploy \
    -p "$CICD_TOKEN" \
    --max-concurrent 3 \
    --skip-existing \                   # Skip common base layers between architectures
    --retry-attempts 3 \
    --verbose
done
```

## πŸ”§ Advanced Configuration

### **Environment Variables**
Configure defaults and credentials:

```bash
# Authentication
export DOCKER_PUSHER_USERNAME=myuser
export DOCKER_PUSHER_PASSWORD=mypassword

# Performance Configuration
export DOCKER_PUSHER_MAX_CONCURRENT=4
export DOCKER_PUSHER_TIMEOUT=3600
export DOCKER_PUSHER_LARGE_LAYER_THRESHOLD=1073741824
export DOCKER_PUSHER_RETRY_ATTEMPTS=5

# Behavior Configuration
export DOCKER_PUSHER_SKIP_TLS=true
export DOCKER_PUSHER_VERBOSE=true
export DOCKER_PUSHER_SKIP_EXISTING=true

# Simplified command with env vars
docker-image-pusher -r https://registry.com/app:v1.0 -f app.tar
```

### **Performance Tuning Matrix**

#### **Network-Based Optimization**

| Network Type | Max Concurrent | Timeout | Large Layer Threshold | Retry Attempts |
|--------------|----------------|---------|----------------------|----------------|
| **Slow (< 10 Mbps)** | 1 | 3600s | 512MB | 10 |
| **Standard (10-100 Mbps)** | 2-3 | 1800s | 1GB | 5 |
| **Fast (100Mbps-1Gbps)** | 4-6 | 600s | 2GB | 3 |
| **Ultra-Fast (> 1Gbps)** | 6+ | 300s | 4GB | 2 |

#### **Image Size Optimization**

| Image Size | Max Concurrent | Timeout | Large Layer Threshold | Recommended |
|------------|----------------|---------|----------------------|-------------|
| **< 1GB** | 2 | 600s | 256MB | Standard settings |
| **1-5GB** | 3 | 1800s | 512MB | Balanced performance |
| **5-20GB** | 4 | 3600s | 1GB | High performance |
| **> 20GB** | 4-6 | 7200s | 2GB | Maximum optimization |

## πŸ“Š Performance Benchmarks v0.2.0

## πŸ” Troubleshooting

### **Common Issues and Solutions**

#### **Performance Optimization**
```bash
# For slow upload speeds
docker-image-pusher \
  -r https://registry.com/app:latest \
  -f app.tar \
  --max-concurrent 4 \              # Increase parallelism
  --large-layer-threshold 536870912 \ # 512MB threshold
  --verbose
```

#### **Memory Usage Optimization**
```bash
# For memory-constrained environments
docker-image-pusher \
  -r https://registry.com/app:latest \
  -f large-app.tar \
  --max-concurrent 1 \              # Reduce parallelism
  --large-layer-threshold 268435456 \ # 256MB threshold
  --verbose
```

#### **Network Issues**
```bash
# For unstable or high-latency networks
docker-image-pusher \
  -r https://registry.com/app:latest \
  -f app.tar \
  --max-concurrent 1 \              # Single connection for stability
  --timeout 3600 \                  # Extended timeout
  --retry-attempts 10 \             # More retries
  --verbose
```

#### **Certificate Issues**
```bash
# For self-signed certificates
docker-image-pusher \
  -r https://internal-registry.com/app:latest \
  -f app.tar \
  --skip-tls \                      # Skip TLS verification
  --verbose
```

### **Debug and Validation**
```bash
# Test configuration without uploading
docker-image-pusher \
  -r https://registry.com/app:latest \
  -f app.tar \
  --dry-run \                       # Validate without uploading
  --verbose \
  2>&1 | tee debug.log
```

### **Resume Interrupted Uploads**
```bash
# Resume uploads that were previously interrupted
docker-image-pusher \
  -r https://registry.com/app:latest \
  -f app.tar \
  --skip-existing \                 # Skip already uploaded layers
  --retry-attempts 5 \              # Higher retry count
  --verbose
```

## πŸ“š Migration from v0.1.x

### **Full Backward Compatibility**
v0.2.0 maintains **100% command-line compatibility**. All existing scripts work without changes:

```bash
# This v0.1.x command works identically in v0.2.0
docker-image-pusher \
  -r https://registry.com/app:latest \
  -f app.tar \
  -u user \
  -p pass
# Now uses improved v0.2.0 architecture with better error handling!
```

### **Internal Architecture Changes (No User Impact)**
The v0.2.0 refactoring includes:
- **Modernized Error Types**: `PusherError` β†’ `RegistryError` (internal only)
- **Unified Pipeline**: Consolidated upload/download operations
- **Simplified Modules**: Removed redundant components
- **Enhanced Logging**: Better structured logging system

### **Performance Improvements Available**
```bash
# Take advantage of v0.2.0 performance optimizations
docker-image-pusher \
  -r https://registry.com/app:latest \
  -f app.tar \
  -u user \
  -p pass \
  --max-concurrent 4 \              # Add parallelism
  --large-layer-threshold 1073741824 \ # Optimize for large layers
  --skip-existing                   # Smart layer skipping
```

### **Enhanced Error Handling**
```bash
# Benefit from improved error handling and retry logic
docker-image-pusher \
  -r https://registry.com/app:latest \
  -f large-app.tar \
  -u user \
  -p pass \
  --retry-attempts 5 \              # Better retry handling
  --timeout 3600 \                  # Configurable timeouts
  --verbose                         # Improved error messages
```

## 🀝 Contributing

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

## πŸ“ Version History

### **v0.2.0 (2025-01-XX) - Architecture Refactoring** πŸ—οΈ
- **BREAKING**: Major module restructuring and naming improvements
- **NEW**: Unified pipeline architecture replacing redundant components
- **NEW**: Modern error handling with `RegistryError` type
- **NEW**: Enhanced logging system (renamed from output)
- **REMOVED**: Legacy upload/network modules and redundant components
- **IMPROVED**: Simplified codebase with better maintainability
- **IMPROVED**: Cleaner module structure and import paths
- **COMPATIBILITY**: Command-line interface remains fully compatible
- **PERFORMANCE**: Improved memory efficiency and error handling

#### **Breaking Changes for Library Users:**
- `PusherError` β†’ `RegistryError`
- `crate::output::` β†’ `crate::logging::`
- Removed legacy upload and network modules
- Simplified pipeline architecture

#### **New Project Structure:**
```
src/
β”œβ”€β”€ cli/                    # Command line interface
β”œβ”€β”€ error/                  # Unified error handling (RegistryError)
β”œβ”€β”€ image/                  # Image parsing and caching  
β”œβ”€β”€ logging/                # Logging system (renamed from output)
β”œβ”€β”€ registry/               # Unified registry operations
```

### v0.1.4 (2025-06-07)
- Added support for modern Docker registry API features
- Improved error handling with clearer messages
- Enhanced compatibility with Harbor repositories
- Fixed authentication issues with private registries
- Updated dependencies to latest versions
- Performance optimizations for large image uploads

## πŸ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## πŸ†˜ Support

- πŸ“– [Documentation]https://github.com/yorelog/docker-image-pusher/wiki
- πŸ› [Report Issues]https://github.com/yorelog/docker-image-pusher/issues
- πŸ’¬ [Discussions]https://github.com/yorelog/docker-image-pusher/discussions
- πŸ“§ Email: yorelog@gmail.com

## πŸ† Acknowledgments

- Docker Registry HTTP API V2 specification
- Rust async ecosystem for enabling high-performance networking
- All contributors and users providing feedback
- Enterprise users who provided requirements for the v0.2.0 architecture

---

**⚠️ Security Notice**: Always use secure authentication methods in production. Consider using environment variables, credential files, or secure vaults instead of command-line arguments for sensitive information.

**πŸš€ v0.2.0 Architecture Tip**: The new unified pipeline architecture provides better error handling and performance. Monitor the verbose output to understand upload progress and optimize settings for your environment.