docker-squash cannot handle opaque directories
See original GitHub issueWhen the content of a directory is removed, a .wh..wh.opq file is created in that directory to announce thatits (including subdirs and their contents) should be ignored.
Currently, docker-squash just skips those files. This leads to files introduced in lower layers and removed in a top layer to re-appear in the squashed image.
This can be reproduced with:
#!/bin/bash
docker build -t broken-layers:latest - > /dev/null 2>&1 <<EOF
FROM fedora:30
RUN mkdir -p /d1 && touch /d1/foobar
RUN rm -rf /d1 && mkdir -p /d1 && touch /d1/foo
EOF
docker-squash -t broken-layers:squashed broken-layers:latest > /dev/null 2>&1
# Here we can see the content for the squashed image and the non-squashed image are different
echo 'Running `ls /d1` in non-squashed container'
docker run -it --rm broken-layers:latest ls -R /d1
echo 'Running `ls /d1` in squashed container'
docker run -it --rm broken-layers:squashed ls -R /d1
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Feature request: Bring docker disk efficiency to level of squashfs
You can have a container that has a squashfs filesystem image in a file which you mount loopback, but that needs cap_sys_admin in...
Read more >Use the OverlayFS storage driver - Docker Documentation
When a directory is deleted within a container, an opaque directory is created within the container ( upperdir ). This works in the...
Read more >Building Good Docker Images - Hacker News
I've been using it (outside Docker) for various Ruby apps, and I can't say it's been easy, but a large part of the...
Read more >docker-squash Changelog - pyup.io
The `--from-layer` argument can take now numeric value which specifies how many layers should be squashed. - Temporary directories are now removed in...
Read more >fabric8io/docker-maven-plugin
dependencies in the /maven directory (and which are specified with an assembly ... Images can be specified in any order and the plugin...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I have a fix for this coded locally. I want to look at it next week too to see how it can be improved because I don’t like the current appraoch that much.
Merged, 1.0.8 released and built for Fedora and RHEL.