Docker volume driver for Digital Ocean block storage. Mounts your Digital Ocean volumes as Docker volumes in your containers.
-
Create a personal access token in the Digital Ocean backend. It needs to have both
read
andwrite
scope. -
Install the volume driver on your node:
docker plugin install decentralize/dobs-volume-plugin:0.2.0 TOKEN=<DIGITALOCEAN API TOKEN>
Optionally, you can set the
API_BASE_URL
as well. (It defaults tohttps://api.digitalocean.com/
.)
-
You need to create a Digital Ocean volume manually (via the web interface or API) first.
- Choose
ext4
as a filesystem. - Make sure the volume is not attached to any droplet.
- Choose
-
Create a docker volume:
docker volume create -d decentralize/dobs-volume-plugin:0.2.0 -o name=<NAME OF DIGITALOCEAN VOLUME> -o uid=<UID TO CHOWN TO> -o gid=<GID TO CHOWN TO> <NAME OF DOCKER VOLUME>
If the
name
option is missing, the Digital Ocean volume name is supposed to be the same as the Docker volume name.The data directory will be chown´ed to
uid
:gid
. Both default to0
(i.e.root:root
). -
Example usage:
docker run -it --rm -v <NAME OF DOCKER VOLUME>:/mnt alpine
- The volume needs to exist and be formatted with
ext4
. - The mount will fail if the volume is already attached to a different droplet. (This limitation is probably going to be removed, see TODO.)
- Allow forcing detachment (needs testing!)
- Include fields in logging (current volume etc.)
- Make timeouts configurable