Skip to content

fix: pull the new image before restarting Dokploy on update - #35

Merged
agentHits merged 1 commit into
AgentHits-Devfrom
fix/update-prepull-image
Oct 7, 2026
Merged

agentHits merged 1 commit into
AgentHits-Devfrom
fix/update-prepull-image

Conversation

@agentHits

Copy link
Copy Markdown
Collaborator

Problem

The dokploy service updates stop-first, so the swarm task pulled the new 4.4 GB image only after the old container had stopped. On dev the panel was down for 2 min 12 s (old container finished 11:31:42 UTC, new one started 11:33:54 UTC) and Traefik answered Bad Gateway the whole time.

Fix

  • Pull first. getAgentHitsUpdateCommand and the new getOfficialUpdateCommand start with docker pull <image> || exit 1, while the old container still serves the panel. The swarm task then finds the image locally, so the downtime is just the restart (~15–20 s). If the pull fails, the service is not touched.
  • Wait for the real restart. The dialog used to reload after a fixed 8 s once /api/health answered. With the pull in front, the old server still answers at that point, so the dialog would have reloaded into the old version. It now waits until the server has gone down once and is healthy again (requests time out after 5 s, gives up after 20 min with an error). Texts say the panel stays usable during the download.
  • List untagged images. Images that swarm pulls by digest have no tag, and docker image ls hides them unless -a is passed. The running image after a UI update was one of them, so the image list (feat: optionally remove old Dokploy images on web server update #34) didn't show it and the cleanup would never remove such images. Both now use docker image ls -a.

Checks

  • vitest __test__/settings/ __test__/security/: 253 passed (new: pull runs before docker service update in both commands, keep-count env on the official path, -a in listing and cleanup).
  • tsc --noEmit in apps/dokploy; biome clean; sh -n on the generated update and cleanup scripts.
  • On dev (read-only): confirmed the stop→pull→start timeline from container timestamps and docker events, and that the running digest-only image shows only with -a.
  • Not run end to end: a real update through the dialog with this build.

🤖 Generated with Claude Code

The dokploy service updates stop-first, so the swarm task pulled the new
4.4 GB image only after the old container had stopped. On dev that left
the panel down for 2 min 12 s (old container stopped 11:31:42, new one
started 11:33:54) and Traefik answered Bad Gateway.

Both update commands (AgentHits and official) now run `docker pull`
first and stop if it fails, so the downtime is only the restart. The
official update moves into getOfficialUpdateCommand to be testable.

The update dialog used to reload after a fixed 8 s once /api/health
answered. With the pull in front, the old server still answers then, so
the dialog now waits until the server has gone down once and is healthy
again (giving up after 20 minutes with an error).

The image list and the cleanup also missed images that swarm pulls by
digest: they have no tag, and `docker image ls` hides untagged images
unless `-a` is passed. The running image after a UI update was one of
them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@agentHits
agentHits merged commit ddd8313 into AgentHits-Dev Oct 7, 2026
11 of 12 checks passed
@agentHits
agentHits deleted the fix/update-prepull-image branch October 7, 2026 12:14
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.

1 participant