dokploy icon indicating copy to clipboard operation
dokploy copied to clipboard

Swarm Service bind mounts not working unless manually created

Open fiechtor opened this issue 1 year ago • 5 comments

To Reproduce

  1. Create a cluster with at least 1 worker node
  2. Create any application
  3. Force placement on worker node
  4. Create bind mount to an absolute path
  5. Deploy application

Current vs. Expected behavior

Current behaviour: The service endlessly tries to start up, never succeeds. The following error message is displayed:

invalid mount config for type "bind": bind source path does not exist: /<parent-dir>/<mount-path>

Even when <parent-dir> has chmod 777, the mount is not created.

Expected behaviour: The directory tree up until the mount directory is created on either saving the bind mount config, or on deployment. Might even benefit from notifying the user with a 'directory does not exist' dialog, with options to create the directory.

Provide environment information

OS: Ubuntu 22.04
VPS Provider: DigitalOcean

Which area(s) are affected? (Select all that apply)

Application, Docker Compose, Docker

Are you deploying the applications where Dokploy is installed or on a remote server?

Both

Additional context

Just as some extra info: I use a glusterfs setup, sharing files on the same path over all of my swarms nodes in disperse mode. Bind mount are thus shared, and can be statically defined. This works great by the way, but the system won't create the mounts for me.

Will you send a PR to fix it?

Yes

fiechtor avatar Jan 23 '25 14:01 fiechtor

How did you configured swarm its not working I tried with shared and dedicated vps first time showed docker demeon timeout when try second time it shows this already joined a swarm and not showing in the cluster tab

Using vultr cloude

osama1998H avatar Feb 17 '25 19:02 osama1998H

Another scenario with the same problematic:

Steps to reproduce:

  • Dokploy server (node dokploy0)
  • Added another two nodes to the cluster (nodes dokploy1, dokploy2)
  • Create application on Dokploy server
  • Add file mount to application. File is available in dokploy server at /etc/dokploy/applications/APP_NAME/files/FILE_NAME
  • Replicas fail to start on nodes dokploy1 or dokploy2 because the file doesn't exists there. The error is:

s0rqz9y0sull28uwn43zmy7yq _ test-gvrapp-dt5hlv.3 registry.example.com/group/web/develop:latest dokploy1 Shutdown Rejected 11 minutes ago "invalid mount config for type "bind": bind source path does not exist: /etc/dokploy/applications/APP_NAME/files/FILE_NAME"

jonhattan avatar Mar 02 '25 22:03 jonhattan

I've had the same situation.

Hoshino-Yumetsuki avatar Apr 04 '25 16:04 Hoshino-Yumetsuki

If I'm not mistaken, the bind mount directory must exist, dokploy and docker swarm will not create it for you.

Siumauricio avatar May 04 '25 23:05 Siumauricio

I think this is not a bug or anything, it is expected if you try to deploy an application manually using docker swarm, it will still throw a warning since that directory does not exist in the worker node which makes sense.

Siumauricio avatar May 17 '25 20:05 Siumauricio

I think I will add a warning in the UI to warn that if you use the cluster features that the directories will not be created automatically nor will they be shared, for that you have to make use of distributed storages and integrating this to dokploy would be too much work for now.

Siumauricio avatar Jul 05 '25 23:07 Siumauricio