Skip to content

Docker volume plugin POC (WIP)#9

Draft
TheGeb wants to merge 15 commits into
dboxed:mainfrom
TheGeb:docker-volume-plugin-poc
Draft

Docker volume plugin POC (WIP)#9
TheGeb wants to merge 15 commits into
dboxed:mainfrom
TheGeb:docker-volume-plugin-poc

Conversation

@TheGeb

@TheGeb TheGeb commented Dec 24, 2025

Copy link
Copy Markdown

POC for docker volume plugin

Overview of behavior for each docker volume API function:

https://docs.docker.com/engine/extend/plugins_volume/#volume-plugin-protocol

  • /VolumeDriver.Create
    • Creates a dboxed volume if it does not exist, and then creates a dboxed volume mount
    • If a dboxed volume already exists and is not locked, it will only create a dboxed volume mount
  • /VolumeDriver.Remove
    • Removes the dboxed volume-mount
    • If the volume is somehow unmounted already, do nothing and return no error?
  • /VolumeDriver.Mount
    • If dboxed volume is somehow not locked, will attempt to lock the volume
    • Will not attempt to create the volume, since docker plugin API does not pass the necessary driver_opts
    • If backupInterval is specified, will serve the volume-mount.
  • /VolumeDriver.Path
    • Lists the mount path for requested docker volume
  • /VolumeDriver.Unmount
    • Stops the dboxed serve process that was started on /VolumeDriver.Mount, but retains lock on the volume
  • /VolumeDriver.Get
    • Lists the mount path and status for requested docker volume
  • /VolumeDriver.List
    • Lists all mount paths from the /var/lib/dboxed directory
  • /VolumeDriver.Capabilities
    • Optional method - unsure yet if the method is necessary for this plugin

@TheGeb

TheGeb commented Dec 24, 2025

Copy link
Copy Markdown
Author

I'm creating this draft primarily to get feedback on overall structure and the planned behavior for the plugin API in the PR description. Most of the changes made are just moving code around for easier reuse and setting up the build process, plugin.go is where the bulk of the actual new logic lives

As of right now it's very incomplete and untested - I haven't written golang before, so I'm mostly wanting see if there are any glaring issues so I can make changes sooner rather than later.

@TheGeb

TheGeb commented Dec 24, 2025

Copy link
Copy Markdown
Author

One alternate approach to the locking lifecycle would be to have /VolumeDriver.Create only create the dboxed volume but not the volume-mount / lock

@codablock

Copy link
Copy Markdown
Contributor

Hey @TheGeb. Thanks for creating the first PR in this project :)

I tried to review the PR at least in regard to the structure of the changes. Here are a few things I noticed:

  1. I assume the reason for the introduction of the services package is that you want the docker driver to invoke stuff that kind of mirrors what the dboxed CLI already does. Best is to separate these changes from the rest and move them into a new PR, so that I can review and merge them on their own.
  2. At the same time, I'm unsure if the docker volume plugin should actually reuse the function from 1.
    Reason is that the steps necessary to implement the API might night necessarily match the way the dboxed CLI was intended to be used. For example, the volume-mount commands are not supposed to create volumes on the API side.
  3. You introduced the docker_volume_plugin tag. I wonder why you didn't just use the linux tag? This would also allow you to avoid the extra build artifact.

I remember that we shortly discussed where to put the docker volume plugin code when we first chatted on Reddit. Seeing this code, I now clearly prefer to to have it inside this repo (and not as an external contribution). There is however one thing that needs to be taken care of now: I initially considered having an external plugin that would invoke the dboxed CLI, which has the advantage that a crash inside a volume-mount serve does not bring down the plugin. This is different when we integrate the plugin directly into dboxed and we must find ways to be crash resistent. One way might still be to create separate processes for the serve operation, but we can figure this out later.

@codablock

Copy link
Copy Markdown
Contributor

@TheGeb I've just created a Discord server that I also plan to use for dev coordination. If you're interested, you can join via the link on dboxed.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants