mirror of
https://github.com/containers/podman.git
synced 2025-10-17 19:24:04 +08:00
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>
This commit is contained in:

committed by
Matthew Heon

parent
08993516a9
commit
fc6dcd12b3
@ -57,6 +57,15 @@ type VolumeConfig struct {
|
||||
DisableQuota bool `json:"disableQuota,omitempty"`
|
||||
// Timeout allows users to override the default driver timeout of 5 seconds
|
||||
Timeout *uint `json:"timeout,omitempty"`
|
||||
// StorageName is the name of the volume in c/storage. Only used for
|
||||
// image volumes.
|
||||
StorageName string `json:"storageName,omitempty"`
|
||||
// StorageID is the ID of the volume in c/storage. Only used for image
|
||||
// volumes.
|
||||
StorageID string `json:"storageID,omitempty"`
|
||||
// StorageImageID is the ID of the image the volume was based off of.
|
||||
// Only used for image volumes.
|
||||
StorageImageID string `json:"storageImageID,omitempty"`
|
||||
}
|
||||
|
||||
// VolumeState holds the volume's mutable state.
|
||||
@ -149,7 +158,7 @@ func (v *Volume) MountCount() (uint, error) {
|
||||
|
||||
// Internal-only helper for volume mountpoint
|
||||
func (v *Volume) mountPoint() string {
|
||||
if v.UsesVolumeDriver() {
|
||||
if v.UsesVolumeDriver() || v.config.Driver == define.VolumeDriverImage {
|
||||
return v.state.MountPoint
|
||||
}
|
||||
|
||||
@ -250,6 +259,12 @@ func (v *Volume) IsDangling() (bool, error) {
|
||||
// drivers are pluggable backends for volumes that will manage the storage and
|
||||
// mounting.
|
||||
func (v *Volume) UsesVolumeDriver() bool {
|
||||
if v.config.Driver == define.VolumeDriverImage {
|
||||
if _, ok := v.runtime.config.Engine.VolumePlugins[v.config.Driver]; ok {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
return !(v.config.Driver == define.VolumeDriverLocal || v.config.Driver == "")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user