-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
Description
missing squash
## Flatten the image by importing an exported container on this image
## Note: it will squash the image with only one layer and lost all metadata such as ENTRYPOINT,
## so apply only to the base image
## TODO: wait docker-squash supporting Docker 1.10+
## ref: https://github.com/jwilder/docker-squash/issues/45
if [ "$docker_image_name" = "docker-base" ]; then
## Run old image in a container
tmp_container=$(docker run -d ${docker_image_name} /bin/bash)
## Export the container's filesystem, then import as a new image
docker export $tmp_container | docker import - ${docker_image_name}
## Remove the container
docker rm -f $tmp_container || true
## Remove the old image
docker rmi -f $image_id || true
fi
Reactions are currently unavailable