docker build --squash -t myapp:squashed .

Category: Docker

docker build --squash -t myapp:squashed .

Squash all layers into one after build (reduces image size)

Merges all image layers into a single layer after building, reducing total image size.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.