diff options
author | Matthew Heon <matthew.heon@pm.me> | 2022-09-16 15:00:37 -0400 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2022-09-22 13:07:40 -0400 |
commit | fc6dcd12b3430f2d1ee495ef19d184a088f3bb34 (patch) | |
tree | 0037ce64d14f971fec5cd29e16a63e7a0f331dc1 /libpod/runtime_cstorage.go | |
parent | 08993516a939576fa009db6e7ed32524026a822d (diff) | |
download | podman-fc6dcd12b3430f2d1ee495ef19d184a088f3bb34.tar.gz podman-fc6dcd12b3430f2d1ee495ef19d184a088f3bb34.tar.bz2 podman-fc6dcd12b3430f2d1ee495ef19d184a088f3bb34.zip |
Add support for 'image' volume driver
We added the concept of image volumes in 2.2.0, to support
inspecting an image from within a container. However, this is a
strictly read-only mount, with no modification allowed.
By contrast, the new `image` volume driver creates a c/storage
container as its underlying storage, so we have a read/write
layer. This, in and of itself, is not especially interesting, but
what it will enable in the future is. If we add a new command to
allow these image volumes to be committed, we can now distribute
volumes - and changes to them - via a standard OCI image registry
(which is rather new and quite exciting).
Future work in this area:
- Add support for `podman volume push` (commit volume changes and
push resulting image to OCI registry).
- Add support for `podman volume pull` (currently, we require
that the image a volume is created from be already pulled; it
would be simpler if we had a dedicated command that did the
pull and made a volume from it)
- Add support for scratch images (make an empty image on demand
to use as the base of the volume)
- Add UOR support to `podman volume push` and
`podman volume pull` to enable both with non-image volume
drivers
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/runtime_cstorage.go')
-rw-r--r-- | libpod/runtime_cstorage.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libpod/runtime_cstorage.go b/libpod/runtime_cstorage.go index 372434b49..5917b7931 100644 --- a/libpod/runtime_cstorage.go +++ b/libpod/runtime_cstorage.go @@ -86,6 +86,17 @@ func (r *Runtime) RemoveStorageContainer(idOrName string, force bool) error { return fmt.Errorf("refusing to remove %q as it exists in libpod as container %s: %w", idOrName, ctr.ID, define.ErrCtrExists) } + // Error out if this is an image-backed volume + allVols, err := r.state.AllVolumes() + if err != nil { + return err + } + for _, vol := range allVols { + if vol.config.Driver == define.VolumeDriverImage && vol.config.StorageID == ctr.ID { + return fmt.Errorf("refusing to remove %q as it exists in libpod as an image-backed volume %s: %w", idOrName, vol.Name(), define.ErrCtrExists) + } + } + if !force { timesMounted, err := r.store.Mounted(ctr.ID) if err != nil { |