-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
LCOW: Regular mount if only one layer #36052
LCOW: Regular mount if only one layer #36052
Conversation
daemon/graphdriver/lcow/lcow_svm.go
Outdated
@@ -304,6 +304,9 @@ func (svm *serviceVM) createUnionMount(mountName string, mvds ...hcsshim.MappedV | |||
cmd = fmt.Sprintf("mount -t overlay overlay -olowerdir=%s %s", | |||
strings.Join(lowerLayers, ","), | |||
mountName) | |||
} else if len(mvds) == 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dunno if there ever is a case where mvds[0].ReadOnly && len(mvds) == 1
, but I think it makes sense to move this check before the mvds[0].ReadOnly
check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe there is such a case. But yes, I can move it to before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gupta-ak Updated.
daemon/graphdriver/lcow/lcow_svm.go
Outdated
@@ -304,6 +304,9 @@ func (svm *serviceVM) createUnionMount(mountName string, mvds ...hcsshim.MappedV | |||
cmd = fmt.Sprintf("mount -t overlay overlay -olowerdir=%s %s", | |||
strings.Join(lowerLayers, ","), | |||
mountName) | |||
} else if len(mvds) == 1 { | |||
// `FROM SCRATCH` case and the only layer. No overlay required. | |||
cmd = fmt.Sprintf("mount %s %s", mvds[0].ContainerPath, mountName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this cause problems for Diff
? The files are normally located in id/upper
for the read write layer, so you might want to do "mount %s/upper %s"
instead (and create the directory).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't. With this change I can commit and pull images just fine (that go through diff). Note as I mentioned there is another change for opengcs server-side not yet submitted which is required for this change to be complete. This still passes the LCOW validation without regressions. Note also FROM scratch
currently doesn't work at all in LCOW
For example, this still works:
PS E:\docker\build\lcow-copy> docker pull --platform=linux ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu
8f7c85c2269a: Pull complete
9e72e494a6dd: Pull complete
3009ec50c887: Pull complete
9d5ffccbec91: Pull complete
e872a2642ce1: Pull complete
Digest: sha256:d3fdf5b1f8e8a155c17d5786280af1f5a04c10e95145a515279cf17abdf0191f
Status: Downloaded newer image for ubuntu:latest
PS E:\docker\build\lcow-copy> docker run -it ubuntu sh
#
# echo foo > a.txt
#
PS E:\docker\build\lcow-copy> docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
de9fffe3fb88 ubuntu "sh" 15 seconds ago Exited (0) 2 seconds ago vigilant_sammet
PS E:\docker\build\lcow-copy> docker commit de9
sha256:1a1cbb9be1e44cd61b10c3e488229beb0e59e8cf54b7e89d30e673ee20e94d7b
PS E:\docker\build\lcow-copy> docker run --rm 1a1 sh
PS E:\docker\build\lcow-copy> docker run --rm -it 1a1 sh
# ls -l a.txt
-rw-r--r-- 1 root root 4 Jan 18 19:57 a.txt
#
PS E:\docker\build\lcow-copy>
Signed-off-by: John Howard <jhoward@microsoft.com>
0eacdcf
to
420dc4e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@thaJeztah PTAL. This is one of the moving pieces in getting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
Signed-off-by: John Howard jhoward@microsoft.com
This is the moby/moby side of the fix to support
FROM scratch
. If there's only one layer, then don't do an overlay mount, just a regular mount instead. (Note there's opengcs fixes required too for the end-to-end scenario to work, I'm putting those changes together and teasing them apart from my work-in-progress branch where I'm fixing a slew of LCOW bugs)@gupta-ak @johnstep PTAL.