Multiple docker volumes on a single Block Storage Volume?

Using the Docker Volume Driver For Linode, is it possible to persist multiple docker volumes onto a single Block Storage Volume?

Put another way, does the Docker Volume Driver For Linode only allow one Docker Volume per Block Storage Volume?

I have created a two node docker swarm (one master, and one worker) to host my personal infrastructure. I have attached a Linode Volume to the Linode instance hosting the Docker Swarm Manager. The intention was to persist all my Docker Volumes to a single Linode Volume (i.e Block Storage).

When I create a Docker Volume using the command

docker volume create -d linode my_test_volume

And inspect the volume:

docker volume inspect my_test_volume

I get the following output:

[
    {
        "CreatedAt": "0001-01-01T00:00:00Z",
        "Driver": "linode:latest",
        "Labels": {},
        "Mountpoint": "/mnt/my_test_volume",
        "Name": "my_test_volume",
        "Options": {
            "size": "10"
        },
        "Scope": "global"
    }
]

The create options only seem to allow you to define size, filesystem and delete-on-remove. Is it possible to create another docker volume on that Linode Volume, rather than creating a new Linode Volume?

Am I missing something? Or am I approaching Docker Swarm persistence from the wrong angle?

1 Reply

Based on the GitHub readme, it looks like you can only have one container for each volume:

Volumes can be mounted to one container at the time because Linux Block Storage volumes can only be attached to one Linode at the time.

You could use multiple Block Storage volumes to achieve persistency. In this scenario, you'd need your original volume plus a volume for your worker container. You could also consider using something like GlusterFS to replicate volumes across nodes. You could also consider moving your setup over to Kubernetes; this would potentially be a more involved process, but could be very useful.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct