question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

docker-squash cannot handle opaque directories

See original GitHub issue

When 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:closed
  • Created 4 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
goldmanncommented, Oct 11, 2019

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.

1reaction
goldmanncommented, Oct 15, 2019

Merged, 1.0.8 released and built for Fedora and RHEL.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found