Support image tar, without accessing Docker daemon
Enable Docker Daemon-Free Image Squashing
This PR directly addresses and resolves Issue #24: "Make it possible to run squashing without accessing Docker daemon" by introducing the ability for docker-squash to directly process Docker images from tar files. This eliminates the need for a running Docker daemon, significantly enhancing flexibility for image optimization in CI/CD pipelines, air-gapped environments, and systems without Docker installed.
Key Benefits
- No Docker Daemon Required: Squash images anywhere you can save them as a tar file.
- Ideal for Restricted Environments: Works seamlessly in CI/CD, air-gapped setups, or when Docker isn't running.
- OCI Format Support: The tool automatically detects and processes images from OCI-formatted input tar files. Please note: Currently, testing has been focused solely on OCI format images.
- Preserves Layer History: Ensures compatibility and traceability for your squashed images.
How to Use
-
Export the Image:
$ docker save -o source.tar jboss/wildfly:latest -
Squash from Tar:
$ python -m docker_squash.cli --input-tar source.tar --tag jboss/wildfly:squashed -f 8 --output-path squashed.tar --load-image false- Use
--input-tarfor your source image file. --tagis recommended for the new image name.--output-pathspecifies where to save the squashed tar file.--load-image falseprevents the tool from attempting to load the image directly into a Docker daemon.
- Use
-
Load into Docker (Optional):
$ docker load -i squashed.tar
This enhancement significantly broadens docker-squash's utility, making image size optimization more accessible across diverse development and deployment scenarios.
hello,sir @goldmann @rnc it appears there's an issue with the runner environment. It looks like the CI/CD checks are failing due to the Ubuntu 20.xx runner deprecation (as per the error message). This doesn't seem to be related to my code changes.
@lyon-v I've fixed the runners and rebased. However I think you need to run ./support/run_formatter.py to fixup the formatting as well.
@rnc Hi there! Apologies for the delayed response. I've fixed the code formatting and it has passed the checks now.
Sir @rnc @goldmann .Do I need to squash these two commits into a single one?
@lyon-v Did you wish to discuss any of the comments?
sir, my apologies for the slow response. I've been swamped with work lately, but I'll reply to or fix these issues shortly.