pub struct VolumeMount {
pub name: String,
pub target: String,
pub read_only: bool,
pub driver: Option<VolumeDriver>,
}Expand description
A named Docker volume to attach to a container at target.
Built with VolumeMount::named and the with_* builders; validated by
VolumeMount::validate (called for you by
crate::lifecycle::Lifecycle::run).
Fields§
§name: StringDocker volume name (not a path). Created by dockerd on first use.
target: StringAbsolute path inside the container.
read_only: boolMount read-only inside the container.
driver: Option<VolumeDriver>Optional volume-plugin driver (name, driver options). None uses
dockerd’s default local driver, or whatever driver an
already-existing volume of this name was created with.
Implementations§
Source§impl VolumeMount
impl VolumeMount
Sourcepub fn named(name: impl Into<String>, target: impl Into<String>) -> Self
pub fn named(name: impl Into<String>, target: impl Into<String>) -> Self
A read-write named volume at target, default driver.
pub fn read_only(self) -> Self
Sourcepub fn with_driver(
self,
driver: impl Into<String>,
options: HashMap<String, String>,
) -> Self
pub fn with_driver( self, driver: impl Into<String>, options: HashMap<String, String>, ) -> Self
Back the volume with a volume-plugin driver (for example
my-driver). Options must not contain credentials; see the module doc.
Sourcepub fn validate(&self) -> Result<(), SubstrateError>
pub fn validate(&self) -> Result<(), SubstrateError>
Reject mounts dockerd would refuse, or that would silently mean something other than a named volume, before any Docker call is made.