Sign inSign up

ondh/docker-squash

By ondh

Updated over 2 years ago

docker-squash in docker

Image
1

3.8K

ondh/docker-squash repository overview

docker-squash in docker

Thanks to https://github.com/goldmann/docker-squash

Usage

Basic use
docker run --rm -it -v $(which docker):/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock ondh/docker-squash <old image> -t <new image> -f <from_layer>
Use alias
alias docker-squash='docker run --rm -it -v /usr/bin/docker:/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock ondh/docker-squash docker-squash'
# then use
docker-squash -h

docker-squash <old image> -t <new image> -f <from_layer>
cli help
# docker-squash -h
usage: cli.py [-h] [-v] [--version] [-d] [-f FROM_LAYER] [-t TAG]
              [--tmp-dir TMP_DIR] [--output-path OUTPUT_PATH]
              image

Docker layer squashing tool

positional arguments:
  image                 Image to be squashed

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         Verbose output
  --version             Show version and exit
  -f FROM_LAYER, --from-layer FROM_LAYER
                        Number of layers to squash or ID of the layer (or image ID or image name) to squash from.
                        In case the provided value is an integer, specified number of layers will be squashed.
                        Every layer in the image will be squashed if the parameter is not provided.
  -t TAG, --tag TAG     Specify the tag to be used for the new image. If not specified no tag will be applied
  -m MESSAGE, --message MESSAGE
                        Specify a commit message (comment) for the new image.
  -c, --cleanup         Remove source image from Docker after squashing
  --tmp-dir TMP_DIR     Temporary directory to be created and used. This will NOT be deleted afterwards for
                        easier debugging.
  --output-path OUTPUT_PATH
                        Path where the image may be stored after squashing.
  --load-image [LOAD_IMAGE]
                        Whether to load the image into Docker daemon after squashing
                        Default: true

Tag summary

Content type

Image

Digest

sha256:103a536b3

Size

25.8 MB

Last updated

over 2 years ago

docker pull ondh/docker-squash