Skip to main content
A newer release of this product is available.

Work with volumes

Contributors netapp-aruldeepa

You can easily create, clone, and remove volumes using the standard docker volume commands with the Astra Trident driver name specified when needed.

Create a volume

  • Create a volume with a driver using the default name:

    docker volume create -d netapp --name firstVolume
  • Create a volume with a specific Astra Trident instance:

    docker volume create -d ntap_bronze --name bronzeVolume
    Note If you do not specify any options, the defaults for the driver are used.
  • Override the default volume size. See the following example to create a 20GiB volume with a driver:

    docker volume create -d netapp --name my_vol --opt size=20G
    Tip Volume sizes are expressed as strings containing an integer value with optional units (example: 10G, 20GB, 3TiB). If no units are specified, the default is G. Size units can be expressed either as powers of 2 (B, KiB, MiB, GiB, TiB) or powers of 10 (B, KB, MB, GB, TB). Shorthand units use powers of 2 (G = GiB, T = TiB, …).

Remove a volume

  • Remove the volume just like any other Docker volume:

    docker volume rm firstVolume
    Important When using the solidfire-san driver, the above example deletes and purges the volume.

Perform the steps below to upgrade Astra Trident for Docker.

Clone a volume

When using the ontap-nas, ontap-san, solidfire-san, and gcp-cvs storage drivers, Astra Trident can clone volumes. When using the ontap-nas-flexgroup or ontap-nas-economy drivers, cloning is not supported. Creating a new volume from an existing volume will result in a new snapshot being created.

  • Inspect the volume to enumerate snapshots:

    docker volume inspect <volume_name>
  • Create a new volume from an existing volume. This will result in a new snapshot being created:

    docker volume create -d <driver_name> --name <new_name> -o from=<source_docker_volume>
  • Create a new volume from an existing snapshot on a volume. This will not create a new snapshot:

    docker volume create -d <driver_name> --name <new_name> -o from=<source_docker_volume> -o fromSnapshot=<source_snap_name>

Example

docker volume inspect firstVolume

[
    {
        "Driver": "ontap-nas",
        "Labels": null,
        "Mountpoint": "/var/lib/docker-volumes/ontap-nas/netappdvp_firstVolume",
        "Name": "firstVolume",
        "Options": {},
        "Scope": "global",
        "Status": {
            "Snapshots": [
                {
                    "Created": "2017-02-10T19:05:00Z",
                    "Name": "hourly.2017-02-10_1505"
                }
            ]
        }
    }
]

docker volume create -d ontap-nas --name clonedVolume -o from=firstVolume
clonedVolume

docker volume rm clonedVolume
docker volume create -d ontap-nas --name volFromSnap -o from=firstVolume -o fromSnapshot=hourly.2017-02-10_1505
volFromSnap

docker volume rm volFromSnap

Access externally created volumes

You can access externally created block devices (or their clones) by containers using Trident only if they have no partitions and if their filesystem is supported by Astra Trident (for example: an ext4-formatted /dev/sdc1 will not be accessible via Astra Trident).