Skip to content

fix(compose): start with the custom command so its extra compose files are kept - #5807

Open
moataz-hjaiji wants to merge 1 commit into
Dokploy:canaryfrom
moataz-hjaiji:fix/compose-start-custom-command
Open

moataz-hjaiji wants to merge 1 commit into
Dokploy:canaryfrom
moataz-hjaiji:fix/compose-start-custom-command

Conversation

@moataz-hjaiji

@moataz-hjaiji moataz-hjaiji commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What is this PR about?

Start on a Compose service ran a fixed docker compose -p <app> -f <composePath> up -d and ignored the service's custom Command, which Deploy and Redeploy use through createCommand. With a custom command that adds an override file (the workaround from #1727 for multiple compose files), Stop then Start recreated the containers without the override, losing its networks, aliases, ports, labels and environment.

startCompose now uses createCommand(compose) when a custom command is set, so Start brings the service back with the same compose files as the last deploy. The command goes through the same sanitizing as on deploy, so shell control characters are still rejected. Without a custom command, Start runs exactly as before.

Note: Start now runs the custom command as written. If it contains build flags (--build, --pull always), Start will apply them too, the same as a deploy.

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.

Tested with unit tests, not yet on a running instance:

  • New __test__/compose/compose-start-command.test.ts (3 cases): no custom command keeps the old Start command; a custom command with an override file is used as-is; a command with shell control characters is rejected and nothing runs. The two new cases fail without the fix.
  • pnpm typecheck and biome check on the changed files pass.
  • Full vitest run: the same pre-existing failures as on canary in my environment (native bcrypt binding, Docker swarm, real git/build tests), plus the 3 new passing tests.

Issues related (if applicable)

closes #5799

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

Start now uses the configured custom command through createCommand, keeping extra Compose files.

  • Compose Start reuses a saved custom command and its extra files.

Reviews (1) · Last reviewed commit: "fix(compose): start with the custom comm..." · Reviewed by Greptile

…s are kept

Start ran a fixed `docker compose -f <composePath> up -d`, ignoring the
custom command that deploy uses. With a command that adds an override file,
Stop then Start recreated the containers without the override.

Closes Dokploy#5799

This branch has not been deployed

No deployments
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.

Compose "Start" ignores the custom Command, so overlay compose files are lost after Stop/Start

1 participant