Repository navigation
Conversation
On daemon restart, prepareMountPoints restores the Layer reference for
type=image mount points but does not re-mount the layer. With graphdriver
(overlay2), the merged/ directory is removed on daemon shutdown, leaving
config.Source pointing to a stale path. When setupMounts subsequently
calls safepath.Join with a subpath, evaluatePath calls
filepath.EvalSymlinks on config.Source and fails with ENOENT.
Fix by calling layer.Mount("") for stopped containers (alive=false) to
re-mount the overlay and update config.Source with the live path. The
alive guard avoids double-mounting live-restored running containers where
the overlay is still active. The existing Unmount in removeMountPoints
balances this Mount at container deletion time.
Enable the regression test TestRunMountImageSubpathDaemonRestart which
was previously skipped for graphdriver.
Fixes: moby#50999
Signed-off-by: Andrew Liu <[email protected]>
Signed-off-by: Andrew Liu <[email protected]>
f8afa11 to
6a069c6
Compare
|
Rebased on current master to refresh CI. I also noticed this branch had accidentally been based on top of my #52722 (it was carrying that PR's Recap of the fix: after a daemon restart, an image-mount source points at the overlay2 Would appreciate a look when someone has a moment. |
Description
Containers with
type: imagevolumes and asubpathfail to start after a daemon restart:This only affects graphdriver (overlay2); the containerd snapshotter is not affected.
Root cause:
prepareMountPointsrestores theLayerreference viaGetLayerByIDbut never re-mounts the layer. With graphdriver, the overlay2merged/directory is removed on daemon shutdown, leavingconfig.Sourcepointing to a stale path. WhensetupMountscallssafepath.Join(ctx, m.Source, subpath),evaluatePathcallsfilepath.EvalSymlinks(m.Source)and fails withENOENT.Fix: Call
layer.Mount("")for stopped containers (alive=false) to re-mount the overlay and updateconfig.Sourcewith the live path. Thealiveguard avoids double-mounting live-restored running containers where the overlay is still active. The existingUnmountinremoveMountPointsbalances thisMountat deletion time.Enables the regression test
TestRunMountImageSubpathDaemonRestart(added in #51831) which was previously skipped for graphdriver.Fixes: #50999
How to verify
Release notes (optional)
A picture of a cute animal
🦦
Created with: Claude Code