Skip to content

docker-base not squashed #124

@lguohan

Description

@lguohan

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions