Skip to content

feat(compose): show usage path for file mounts in volume dialogs - #5474

Open
jereok91 wants to merge 2 commits into
Dokploy:canaryfrom
jereok91:feat/file-mount-usage-hint
Open

jereok91 wants to merge 2 commits into
Dokploy:canaryfrom
jereok91:feat/file-mount-usage-hint

Conversation

@jereok91

@jereok91 jereok91 commented Sep 17, 2026

Copy link
Copy Markdown

Show the relative path to reference a File Mount from docker-compose.yml (e.g. ../files/Caddyfile) in the add and update volume dialogs for compose services. The path accounts for the pinned --project-directory used by docker compose and for the compose file location when deploying as a stack.

What is this PR about?

When creating a File Mount for a Compose service, the file is stored in the service's files directory, outside the cloned repository, but the UI never tells you how to reference it from docker-compose.yml. This PR adds a small hint in the Add and Update volume dialogs (Compose services only) showing the relative path and an example volume entry, updated live as you type the file name:

../files/Caddyfile

volumes:

  • ../files/Caddyfile:/path/in/container

The path is computed by getComposeFileMountSource (apps/dokploy/lib/compose-file-mount.ts):

  • docker-compose: when mounts exist, Dokploy runs docker compose with --project-directory pinned to the code dir, so the path is always ../files/<name>, even if composePath is nested (e.g. ./deploy/docker-compose.yml).
  • stack: docker stack deploy has no psolves relative paths from the compose file's
    folder, so a nested composePath adds extrploy/prod/docker-compose.yml../../../files/`). Raw stacks use th

Unit tests cover both compose types, nestedand file names with leading ./ or /.

Also aligns startCompose with deploy so relative mounts resolve against the same base (--project-directory) when the compose has mounts.

Checklist

Before submitting this PR, please make sure that:

  • You created a dedicated branch based on the canary branch.
  • You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
  • You have tested this PR in your local instance. If you have not tested it yet, please do so before submitting. This helps avoid wasting maintainers' time reviewing code that has not been verified by you.

Issues related

closes #5147

Screenshots

image image image

RetriggerConfidence Score: 4/5

The PR should not merge until nested Docker Compose file mounts resolve consistently during both deployment and subsequent start operations.

Summary

This PR adds a Compose file-mount path helper, displays its result in add and update volume dialogs, and adds focused unit coverage.

  • Computes paths according to Compose type, source type, and compose-file nesting.
  • Shows a copyable Compose volume example for managed file mounts.
  • The Docker Compose hint does not remain valid across the existing start lifecycle for nested compose files.
  • The short-syntax example cannot safely represent every filename currently accepted by mount validation.

Reviews (1) · Last reviewed commit: "feat(compose): show usage path for file ..."

Show the relative path to reference a File Mount from docker-compose.yml
(e.g. ../files/Caddyfile) in the add and update volume dialogs for compose
services. The path accounts for the pinned --project-directory used by
docker compose and for the compose file location when deploying as a stack.

Closes Dokploy#5147
Comment thread apps/dokploy/lib/compose-file-mount.ts
…e example source

startCompose ran docker compose without the --project-directory/--env-file
flags used on deploy, so relative mounts in a nested compose file resolved
against a different base after a start. Share the flag builder between both
commands.

Render the file mount example with long volume syntax and a quoted source so
file names containing ':' or ' #' produce valid compose YAML.
@jereok91

Copy link
Copy Markdown
Author

Both Greptile findings were addressed in 5c75bc4 (see replies in each thread). The summary above still reflects the first commit (1a845fe) since I can't retrigger the review as an external contributor.

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.

[Feature Request] Show usage example for File Mounts created in the UI

1 participant