-
Notifications
You must be signed in to change notification settings - Fork 18.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overlay allows deleting directories that aren't empty #13108
Comments
@GordonTheTurtle is this a generic message or did you determine that my issue lacks info? Do I have to follow your template? #ECANNOTCOMPUTE |
Lol you are fine |
There seem to be a few weird overlay bugs wrt Unix sockets, installing pip lol etc |
moby/moby#13108 /etc/monit/conf.d is an empty folder in the base image. Because it is empty a rmdir /etc/monit/conf.d will delete the folder regardless of whether it has files in it or not. This causes tar extracts to always delete /etc/monit/conf.d meaning that the folder only ever has one config in it (which is bad)
@ibuildthecloud interesting that fails on ubuntu's 4.0.1 vbatts@valse ~/tmp (master *) $ docker build -t test .
Sending build context to Docker daemon 2.048 kB
Sending build context to Docker daemon
Step 0 : FROM ubuntu
latest: Pulling from ubuntu
e9e06b06e14c: Pull complete
a82efea989f9: Pull complete
37bea4ee0c81: Pull complete
07f8e8c5e660: Already exists
ubuntu:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
Digest: sha256:8126991394342c2775a9ba4a843869112da8156037451fc424454db43c25d8b0
Status: Downloaded newer image for ubuntu:latest
---> 07f8e8c5e660
Step 1 : RUN mkdir /empty
---> Running in ea2b4971b9ee
---> 3adf0ef44a5b
Removing intermediate container ea2b4971b9ee
Successfully built 3adf0ef44a5b
vbatts@valse ~/tmp (master *) $ docker run -i test bash << "EOF"
> rmdir /empty
> mkdir /empty
> touch /empty/a
> rmdir /empty && echo "I'm a bug"
> EOF
rmdir: failed to remove '/empty': Directory not empty
vbatts@valse ~/tmp (master *) $ docker info
Containers: 2
Images: 5
Storage Driver: overlay
Backing Filesystem: extfs
Execution Driver: native-0.2
Kernel Version: 3.19.5-100.fc20.x86_64
Operating System: Fedora 20 (Heisenbug)
CPUs: 4
Total Memory: 11.43 GiB
Name: valse.usersys.redhat.com
ID: RSJF:6G2K:WRHU:VG4Y:OUFZ:EZDT:UZMQ:5EGF:YGMA:6ADA:BW5B:VN5H
Username: vbatts
Registry: [https://index.docker.io/v1/] |
rawr. i just tested again on |
further, this now bunk container can not be restarted.
I've just boiled this down to a reproduction outside docker: base=$(mktemp -d)
echo ${base}
## make an overlay fs setup
mkdir -p ${base}/{upper,work,merged,mnt,lower}
## make an empty directory in the base layer
mkdir ${base}/lower/empty
## mount the base layer
sudo mount \
-t overlay \
-o rw,lowerdir=${base}/lower/,workdir=${base}/work/,upperdir=${base}/upper/ \
${base}/merged/ ${base}/mnt/
## create a whiteout
rmdir ${base}/mnt/empty
## add the dir back (on top of the whiteout)
mkdir -p ${base}/mnt/empty
touch ${base}/mnt/empty/file.txt
## now rm the non-empty directory
rmdir ${base}/mnt/empty && echo "bug here!"
## cleanup
sudo umount ${base}/mnt
sudo find ${base} |
starting with reporting it against fedora's kernel, https://bugzilla.redhat.com/show_bug.cgi?id=1220915 |
upstream fix done and added to the 4.0 stable tree |
I can confirm that this has already been fixed in upstream:
Closing this issue. 🎉 |
Great. Another one bites the dust. /me dances
|
I know this is not a Docker bug, this is in the kernel itself. I'm only filing here as I expect it will gain the attention of somebody who know where/how to get this fixed.
Test case
Dockerfile
docker build -t test .
The last line should fail but it doesn't.
The text was updated successfully, but these errors were encountered: