Sign inSign up

mtism/local-volume

By mtism

Updated 7 months ago

This plugin acts like the local driver, but you can adjust where the volumes are saved on disk

Plugin
Integration & delivery
Operating systems
Databases & storage
0

957

mtism/local-volume repository overview

local-volume

This is a docker volume plugin that provisions docker volumes on a adjustable local path.
The base path, where to store the volumes is defined at the plugin configuration / installation.
Therefore there is no need to mess around local path at every docker-compose.yml.

For each volume a directory called _ is created located at the defined base path. (e.g. /mnt/myVolume/stackname_volumename)
If you don't set / change the base path, the default /mnt/volumes is used.

With this approach its possible to integrate every storage solution (e.g. GlusterFS), which you already mounted to the host file system.
Keep in mind, that you need to install the plugin on every node of the swarm cluster.

Quick Start

To build the plugin just run make build and then docker plugin ls to verify the plugin is available.

Once the plugin is created this way, the base path can be adjusted:

docker plugin disable local-volume
docker plugin set local-volume BASE_PATH=/mnt/myVolume
docker plugin enable local-volume

Use the same commands if you want to change the base path in the future.

To be able to set up multiple local volumes with different base path, you need to create multiple instances of the plugin with an unique name. For this to work the plugin must be published in a registry.

docker plugin install --alias myVolume registry.example.com/local-volume BASE_PATH=/mnt/myVolume

Example

Now when a volume needed it can be specified and created on the fly like its done for the default local volumes at the docker-compose.yml:

volumes:
  example:
    driver: myVolume:latest
  test:
    driver: myVolume:latest

The example assumes, that you installed the plugin with the alias myVolume as shown above.

Publish to a remote repository

docker-compose builder operations are passed an explicit --context default flag so that, if you wish, you can set a remote docker agent as the build target to deploy directly to a swarm server (as an example)

make build push plugin=registry.example.com/local-volume

References

Tag summary

Content type

Plugin

Digest

sha256:374bbb20f

Size

8.2 MB

Last updated

7 months ago

docker plugin install mtism/local-volume