Skip to content

Add "Deploy with Fresh Volumes" / Reset button for Docker Compose projects #4194

@lamualfa

Description

@lamualfa

What problem will this feature address?

When using Docker Compose deployments, there is no built-in way to redeploy with fresh/clean volumes. This is commonly needed when:

  • Debugging state-related issues that persist across redeployments
  • Resetting a database or persistent data to a clean state
  • Testing a fresh installation scenario

Currently, the only workaround is to manually modify the Run Command in the Advanced tab to prepend a volume cleanup step, for example:

compose -p my-project-ajnxdl -f ./docker-compose.production.yaml down --volumes && docker compose -p my-project-ajnxdl -f ./docker-compose.production.yaml up -d --build --remove-orphans
Image

This is error-prone (easy to forget to revert), requires knowledge of the exact compose command syntax, and isn't accessible to less technical users.

Describe the solution you'd like

Add a "Deploy with Fresh Volumes" button (or a "Reset & Deploy" toggle) to the compose deployment UI. When triggered, it would:

  1. Run docker compose -p <appName> -f <composePath> down --volumes to stop containers and remove their volumes
  2. Then proceed with the normal deployment (build + up)

This could be implemented as:

  • A separate button next to the existing Deploy button, e.g. "Deploy (Fresh Volumes)"
  • Or a toggle/checkbox in the deploy dialog: "Clean volumes before deploying"

The underlying command generation in createCommand() (packages/server/src/utils/docker/compose.ts) would check for this flag and prepend the down --volumes step before the standard up command.

Describe alternatives you've considered

  • Custom Run Command (current workaround) — Works but requires manual editing in the Advanced tab and is easy to forget to revert, leaving the project permanently in "fresh volumes" mode on subsequent deploys.
  • Manual SSH / terminal access — Not all users have direct server access, especially on cloud-hosted instances.
  • A separate "Reset" action (non-deploying) — Useful but requires two clicks (reset + deploy) instead of one. A combined action is more convenient.

Additional context

Relevant code locations:

  • Command generation: packages/server/src/utils/docker/compose.tscreateCommand() function (lines 80-97) builds the docker compose command. This is where the down --volumes prefix would be added.
  • Deploy endpoint: apps/dokploy/server/api/routers/compose.tsdeploy (lines 416-465) and redeploy (lines 466-513) queue the deployment. A new freshVolumes boolean parameter could be added here.
  • Compose schema: packages/server/src/db/schema/compose.ts — The compose table schema where deployment settings are stored.
  • Advanced/Run Command UI: apps/dokploy/components/dashboard/compose/advanced/add-command.tsx — Where users currently set custom commands.
  • Volume cleanup already exists: removeCompose() in packages/server/src/services/compose.ts (lines 422-460) already supports deleteVolumes: true with docker compose down --volumes, so the pattern is established in the codebase.

Will you send a PR to implement it?

Yes, I plan to submit a PR to implement this feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions