Conversation
docker ps --filter name=dokploy is a substring match, so it also matched dokploy-postgres and dokploy-traefik. docker ps lists the newest container first, so after a restart the 2FA migration could run in the wrong container and fail with "can't cd to /app". Select the task by its Swarm service-name label instead, which is compared exactly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Dokploy/dokploy#5359
The 2FA migration step in
security/0.29.3.shfinds the Dokploy container with:Docker's
namefilter is a substring match, so this also matchesdokploy-postgresanddokploy-traefik, anddocker pslists the newest container first. When Postgres or Traefik was started after Dokploy, for example after a reboot, the migration ran inside the wrong container and failed withcan't cd to /app.This selects the task by the label Swarm sets on every service task,
com.docker.swarm.service.name=dokploy, as suggested in the issue. Label filters compare the value exactly, so only thedokployservice's container matches.Testing
Ran the original and the fixed script against a local Swarm laid out like
install.sh: adokployservice, a standalonedokploy-traefikcontainer, and adokploy-postgresservice created last so it is listed first.idandtimeoutwere shimmed to run on macOS.