Docker Image Exporter Service
v1.0.0Use the Whalebag API to programmatically export Docker images to tar files.
http://localhost:5000
curl -X POST http://localhost:5000/api/export \ -H "Content-Type: application/json" \ -d '{"image":"nginx:latest"}' \ -o nginx_latest.tar
import requests response = requests.post( 'http://localhost:5000/api/export', json={'image': 'nginx:latest'} ) if response.status_code == 200: with open('nginx_latest.tar', 'wb') as f: f.write(response.content) print('Image exported successfully!') else: print(f'Error: {response.json()}')
fetch('http://localhost:5000/api/export', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ image: 'nginx:latest' }) }) .then(response => response.blob()) .then(blob => { const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'nginx_latest.tar'; a.click(); });
{"error": "Missing 'image' parameter"}
{"error": "Image not found: invalid:image"}
{"error": "Export failed: ..."}
curl http://localhost:5000/api/health
{ "status": "healthy", "service": "Whalebag", "version": "1.0.0", "docker": { "connected": true, "version": "24.0.7", "images": 15, "containers": 3 }, "cleanup": { "enabled": true, "interval_minutes": 30, "max_age_hours": 1 } }
curl http://localhost:5000/api/stats
{ "temp_directory": "/tmp", "total_files": 3, "total_size_mb": 456.78, "cleanup_config": { "interval_minutes": 30, "max_age_hours": 1 }, "files": [ { "name": "nginx_latest.tar", "size_mb": 142.5, "created": "2025-10-14T18:30:00", "age_hours": 0.5 } ] }
curl -X POST http://localhost:5000/api/cleanup
{ "status": "success", "message": "Cleanup completed successfully" }
Currently, there are no rate limits. However, consider implementing them for production use.
All error responses follow this format:
{ "error": "Description of the error" }
/api/health
endpoint before making requests/api/stats
to monitor storage usage