From 1053743a1c87d8b67b37e8ae4d451bc3874cbb61 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Fri, 28 Aug 2026 15:50:53 -0600 Subject: [PATCH] fix: close terminal websocket when local container shell exits --- apps/dokploy/server/wss/docker-container-terminal.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/dokploy/server/wss/docker-container-terminal.ts b/apps/dokploy/server/wss/docker-container-terminal.ts index bd731476f..45a3a4d34 100644 --- a/apps/dokploy/server/wss/docker-container-terminal.ts +++ b/apps/dokploy/server/wss/docker-container-terminal.ts @@ -182,6 +182,10 @@ export const setupDockerContainerTerminalWebSocketServer = ( ptyProcess.onData((data) => { ws.send(data); }); + ptyProcess.onExit(({ exitCode }) => { + ws.send(`\nContainer closed with code: ${exitCode}\n`); + ws.close(); + }); ws.on("close", () => { ptyProcess.kill(); });