mirror of
https://github.com/containers/podman.git
synced 2025-12-10 15:47:46 +08:00
We do not allow volumes and mounts to be placed at the same location in the container, with create-time checks to ensure this does not happen. User-added conflicts cannot be resolved (if the user adds two separate mounts to, say, /myapp, we can't resolve that contradiction and error), but for many other volume sources, we can solve the contradiction ourselves via a priority hierarchy. Image volumes come first, and are overridden by the `--volumes-from` flag, which are overridden by user-added mounts, etc, etc. The problem here is that we were not properly handling volumes-from overriding image volumes. An inherited volume from --volumes-from would supercede an image volume, but an inherited mount would not. Solution is fortunately simple - just clear out the map entry for the other type when adding volumes-from volumes. Makes me wish for Rust sum types - conflict resolution would be a lot simpler if we could use a sum type for volumes and bind mounts and thus have a single map instead of two maps, one for each type. Fixes #19529 Signed-off-by: Matthew Heon <matthew.heon@pm.me>