salt.states.docker_volume

Warning

This module will be removed from Salt in version 3009 in favor of the docker Salt Extension.

Management of Docker volumes

New in version 2017.7.0.

depends:

docker Python module

Note

Older releases of the Python bindings for Docker were called docker-py in PyPI. All releases of docker, and releases of docker-py >= 1.6.0 are supported. These python bindings can easily be installed using pip.install:

salt myminion pip.install docker

To upgrade from docker-py to docker, you must first uninstall docker-py, and then install docker:

salt myminion pip.uninstall docker-py
salt myminion pip.install docker

These states were moved from the docker state module (formerly called dockerng) in the 2017.7.0 release.

salt.states.docker_volume.absent(name, driver=None)

Ensure that a volume is absent.

New in version 2015.8.4.

Changed in version 2017.7.0: This state was renamed from docker.volume_absent to docker_volume.absent

name

Name of the volume

Usage Examples:

volume_foo:
  docker_volume.absent
salt.states.docker_volume.present(name, driver=None, driver_opts=None, force=False)

Ensure that a volume is present.

New in version 2015.8.4.

Changed in version 2015.8.6: This state no longer deletes and re-creates a volume if the existing volume's driver does not match the driver parameter (unless the force parameter is set to True).

Changed in version 2017.7.0: This state was renamed from docker.volume_present to docker_volume.present

name

Name of the volume

driver

Type of driver for that volume. If None and the volume does not yet exist, the volume will be created using Docker's default driver. If None and the volume does exist, this function does nothing, even if the existing volume's driver is not the Docker default driver. (To ensure that an existing volume's driver matches the Docker default, you must explicitly name Docker's default driver here.)

driver_opts

Options for the volume driver

forceFalse

If the volume already exists but the existing volume's driver does not match the driver specified by the driver parameter, this parameter controls whether the function errors out (if False) or deletes and re-creates the volume (if True).

New in version 2015.8.6.

Usage Examples:

volume_foo:
  docker_volume.present
volume_bar:
  docker_volume.present
    - name: bar
    - driver: local
    - driver_opts:
        foo: bar
volume_bar:
  docker_volume.present
    - name: bar
    - driver: local
    - driver_opts:
        - foo: bar
        - option: value