Repository navigation
Description
This is a weird one. I'll keep digging into this and flesh out the issue as I discover more, but:
I have this directory. It's a ZFS dataset.
root@borg2:/u/apps/locutus/shared/zfs/shopify-a929cf7d522b5f094635fadbec2fbf96fc973c96764e35303e4bc80dc6974dea/weekof-2015-06-01# stat -f . | awk '/Type/ { print $NF }'
zfs
# zfs list | grep a929 | grep week
locutus/shopify-a929cf7d522b5f094635fadbec2fbf96fc973c96764e35303e4bc80dc6974dea/weekof-2015-06-01 47K 144G 28K /u/apps/locutus/shared/zfs/shopify-a929cf7d522b5f094635fadbec2fbf96fc973c96764e35303e4bc80dc6974dea/weekof-2015-06-01
locutus/shopify-a929cf7d522b5f094635fadbec2fbf96fc973c96764e35303e4bc80dc6974dea/weekof-2015-06-01/6ecddc3dd27d5645ec1a2153e7806f99fc1727e0 19K 144G 19K /u/apps/locutus/shared/zfs/shopify-a929cf7d522b5f094635fadbec2fbf96fc973c96764e35303e4bc80dc6974dea/weekof-2015-06-01/6ecddc3dd27d5645ec1a2153e7806f99fc1727e0
When I mount it into a container, the behaviour is quite different on 1.6.0 and 1.7.0, probably due to the Volumes refactor:
1.6.0:
root@0beae52c57ab:/app# grep zfs /proc/mounts
locutus/shopify-f744a0801011b8a849807d3b53df91e719e1bd5ad8523015d984be663482480f/weekof-2015-06-01 /test zfs rw,relatime,xattr,noacl 0 0
locutus/shopify-f744a0801011b8a849807d3b53df91e719e1bd5ad8523015d984be663482480f/weekof-2015-06-01/03f195f2b7f552b7fa8093364fcb4fc0727b574a /test/03f195f2b7f552b7fa8093364fcb4fc0727b574a zfs rw,relatime,xattr,noacl 0 0
root@0beae52c57ab:/app#
Note that here, we see nested volumes.
1.7.0:
For some volumes, depending on circumstances I haven't yet been able to figure out, we get this:
# grep zfs /proc/mounts
locutus/spy-499d8dac8bb0e5d88a981afb20e1fd26fac699799b72cef71f365376e79e89c4 /test zfs rw,relatime,xattr,noacl 0 0
locutus/spy-499d8dac8bb0e5d88a981afb20e1fd26fac699799b72cef71f365376e79e89c4/weekof-2015-06-01 /test/weekof-2015-06-01 zfs rw,relatime,xattr,noacl 0 0
i.e.: the same, and there is no issue.
In other cases, and again, no idea what causes this:
root@borg2:/u/apps/locutus/shared/zfs/shopify-a929cf7d522b5f094635fadbec2fbf96fc973c96764e35303e4bc80dc6974dea/weekof-2015-06-01# docker run -it --entrypoint=/bin/bash -v $(pwd):/test:rw ba5e -l
root@1469d291f2af:/app# grep zfs /proc/mounts
locutus /test zfs rw,relatime,xattr,noacl 0 0
root@1469d291f2af:/app#
So note, here, that this directory is mounted on the host as a ZFS dataset, with the same behaviour on my 1.6.0 nodes and my 1.7.0 nodes. However, the 1.7.0 nodes sometimes bind it inside the containers as locutus (my zpool name) rather than the full dataset name.
There is some very interesting behaviour as a result of this:
root@borg2:/u/apps/locutus/shared/zfs/shopify-a929cf7d522b5f094635fadbec2fbf96fc973c96764e35303e4bc80dc6974dea/weekof-2015-06-01# ls
6ecddc3dd27d5645ec1a2153e7806f99fc1727e0
root@borg2:/u/apps/locutus/shared/zfs/shopify-a929cf7d522b5f094635fadbec2fbf96fc973c96764e35303e4bc80dc6974dea/weekof-2015-06-01# docker run -it --entrypoint=/bin/bash -v $(pwd):/test:rw ba5e -l
root@bde4abe26612:/app# touch /test/what
root@bde4abe26612:/app# logout
root@borg2:/u/apps/locutus/shared/zfs/shopify-a929cf7d522b5f094635fadbec2fbf96fc973c96764e35303e4bc80dc6974dea/weekof-2015-06-01# ls
6ecddc3dd27d5645ec1a2153e7806f99fc1727e0
root@borg2:/u/apps/locutus/shared/zfs/shopify-a929cf7d522b5f094635fadbec2fbf96fc973c96764e35303e4bc80dc6974dea/weekof-2015-06-01# docker run -it --entrypoint=/bin/bash -v $(pwd):/test:rw ba5e -l
root@2ee6bbc4d492:/app# ls /test
6ecddc3dd27d5645ec1a2153e7806f99fc1727e0 what wip-6ecddc3dd27d5645ec1a2153e7806f99fc1727e0.10704
root@2ee6bbc4d492:/app#
To summarize what's happened above:
- List files in dataset on host. Get
ds/{a}. - Mount dataset in new container. See
ds/{a}. Createds/{b}Now container seesds/{a,b}. - Exit container. List files on host. See
ds/{a}. - Start another container with the same mount. See
ds/{a,b}.
What I would expect to see is that the writes from (2) are visible on the host in step 3. I think this is somehow very related to the incorrect-looking mount name in /proc/mounts. I would normally blame ZFS for this, but we have strong empirical evidence that this happens only on docker 1.7.0.
/cc @calavera
Activity
burke commentedon Jun 5, 2015
FWIW
calavera commentedon Jun 5, 2015
oh, this is fun, thanks for open the issue!
I'm going to have to investigate further because I don't see anything strange at first glance. The fact that the mounting name is incorrect makes me think that it's something beyond the new volumes code, but I'm sure it's affecting the behavior somehow.
amylindburg commentedon Jun 5, 2015
burke -- thanks for testing rc2!!!
calavera commentedon Jun 8, 2015
hey @burke I was wondering if you had time to investigate this further. I just ran a very simple test with zfs and I cannot see anything wrong. I'm pretty sure my configuration is very different to yours, so it would be awesome if you had more details about it:
calavera commentedon Jun 8, 2015
I've also created a dataset inside my pool but it looks like it's still mounted as expected 😔
burke commentedon Jun 8, 2015
I'll try to come up with a self-contained reproduction this afternoon.
burke commentedon Jun 8, 2015
This reproduces the problem on my system:
So it appears that the ZFS mount isn't detected when choosing an FS to bind in to the container FS. Possibly-relevant info:
calavera commentedon Jun 8, 2015
mmmm Now I'm wondering if the problem is related to overlay. I just realized that that's the only difference in our setups. I copied your commands and it looks okay in my test vm:
burke commentedon Jun 8, 2015
That did seem likely. However, I tried it and observed the same behaviour. This time:
burke commentedon Jun 8, 2015
So the weird thing, more concisely, is:
invocation
host
container
calavera commentedon Jun 8, 2015
I don't understand anything, it looks like the mount is correct in my vm with overlay, the same kernel, and OS 😢
19 remaining items
rhatdan commentedon Jun 9, 2015
@burke I think you need only the first --make-rshare. Since it will recusively go through the mount points.
burke commentedon Jun 9, 2015
I'll poke at this and try to get the reproduction isolated out of docker, but here's a script:
This is what I get with docker 1.7.0-rc2:
And this is on docker 1.6.0:
crosbymichael commentedon Jun 10, 2015
Do we know if this is confined to using
zfsor does it affect any graph driver?If it affects any graph driver we should look to see if the host has
/mounted asrsharedand set the Privatefs flag in libcontainer for those who do not have this, effectively reverting back the MS_SLAVE|MS_PRIVATE functionality for 1.6 but only for systems whos hosts don't have that support.burke commentedon Jun 10, 2015
I did a bit more digging:
Docker 1.7.0-rc2 has been running since I made this comment, using
--storage-driver=overlay.Throughout this comment, "docker" refers to docker-1.7.0-rc2, and always one binary identical build. "broken" means this script with
DOCKER_HOSTset as indicated breaks, i.e. returns two different devices. "works" indicates the returns match.overlay. Broken.There were actually a bunch of other things I tried in here that I didn't bother to include -- lots of permutations of graph drivers and graph directories. Nothing was broken except the 10 hour old docker. I was very confused when I made that comment, because the problem kind of stopped happening, and I was starting to doubt whether I had troubleshooted correctly. Now it's clear to me that this is a problem that happens reliably after some condition is triggered in the docker daemon, and is resolved by restarting the daemon.
I'm leaving docker to run overnight with the graph-driver set to VFS. Next time I see it break, I'll capture a full
stracewhile I spawn the container. Any other ideas how to troubleshoot this?burke commentedon Jun 10, 2015
I should probably mention that I'm using ZFS for part of my container build workflow, but not actually as a
storage-driver. Once the problem is provoked, it appears to be irrelevant whether I'm mounting ZFS or ext2 into the container -- both will exhibit the problem.crosbymichael commentedon Jun 10, 2015
@burke could you
cat /proc/self/mountinfoand paste the output?burke commentedon Jun 10, 2015
Here it is, but note that in this case, the bug isn't present. I will post again when I can reproduce the problem again.
host
container
vbatts commentedon Jun 10, 2015
so the rootfs on the host is shared. Though the container's rootfs has
master:5in its optional fields. This means that it is MS_SLAVE, not MS_PRIVATE.Still looking
vbatts commentedon Jun 10, 2015
@burke is it possible for you to build a docker binary from #13852 and test your use case with it?
I'm trying your reproducer, and still unable to reproduce your results.
vbatts commentedon Jun 10, 2015
@burke i can build and sign one for you, if needed.
burke commentedon Jun 10, 2015
No worries. I just built #13854, about to install it on the server. It'll be somewhat difficult to prove whether it still has the problem or not, just because of the unpredictability of when it happens, but I'll update as I have more info
vbatts commentedon Jun 10, 2015
@burke glad you're testing #13854, but can you test #13852 as well?
burke commentedon Jun 10, 2015
Sure, I'll do that one now
burke commentedon Jun 10, 2015
I'm actually hesitant to restart docker on that server while I have #13847 (comment) broken. I'm going to hold off for a little bit while I debug that one.