VolumeCLI
clone
clone(source, new_volume_name=None, driver=None, labels={}, options={})
Clone a volume.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source |
ValidVolume
|
The volume to clone |
required |
new_volume_name |
Optional[str]
|
The new volume name. If not given, a random name is chosen. |
None
|
driver |
Optional[str]
|
Specify volume driver name (default "local") |
None
|
labels |
Dict[str, str]
|
Set metadata for a volume |
{}
|
options |
Dict[str, str]
|
Set driver specific options |
{}
|
Returns
A `python_on_whales.Volume`, the new volume.
copy
copy(source, destination)
Copy files/folders between a volume and the local filesystem.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source |
Union[ValidPath, VolumePath]
|
If |
required |
destination |
Union[ValidPath, VolumePath]
|
Same as |
required |
create
create(volume_name=None, driver=None, labels={}, options={})
Creates a volume
Parameters:
Name | Type | Description | Default |
---|---|---|---|
volume_name |
Optional[str]
|
The volume name, if not provided, a long random string will be used instead. |
None
|
driver |
Optional[str]
|
Specify volume driver name (default "local") |
None
|
labels |
Dict[str, str]
|
Set metadata for a volume |
{}
|
options |
Dict[str, str]
|
Set driver specific options |
{}
|
exists
exists(x)
Returns True
if the volume exists. False
otherwise.
It's just calling docker.volume.inspect(...)
and verifies that it doesn't throw
a python_on_whales.exceptions.NoSuchVolume
.
Returns
A `bool`
list
list(filters={})
List volumes
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filters |
Dict[str, Union[str, int]]
|
See the Docker documentation page about filtering
.
An example |
{}
|
Returns
`List[python_on_whales.Volume]`
prune
prune(filters={}, all=False)
Remove volumes
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filters |
Dict[str, Union[str, int]]
|
See the Docker documentation page about filtering
.
An example |
{}
|
all |
bool
|
Remove all unused volumes, not just anonymous ones. |
False
|
remove
remove(x)
Removes one or more volumes
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Union[ValidVolume, List[ValidVolume]]
|
A volume or a list of volumes. An empty list as argument means nothing is done. |
required |