fix(update): pipe pull output through tail to prevent memory exhaustion

Docker's /images/create API streams progress JSON for every layer.
For large images, this can be gigabytes of output that was being
buffered by curl and n8n, causing hangs and disk usage spikes.

Now pipes through `tail -c 10000` to only keep the last 10KB where
error/success messages appear. Discards the streaming progress data.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Lucas Berger
2026-02-02 21:14:25 -05:00
parent 88830a8b61
commit 3e3b9ae47f
+1 -1
View File
@@ -1564,7 +1564,7 @@
}, },
{ {
"parameters": { "parameters": {
"jsCode": "// Build pull image command\nconst imageName = $json.imageName;\n\nreturn {\n json: {\n cmd: `curl -s --max-time 600 --unix-socket /var/run/docker.sock -X POST 'http://localhost/v1.47/images/create?fromImage=${encodeURIComponent(imageName)}'`,\n imageName,\n currentImageId: $json.currentImageId,\n currentVersion: $json.currentVersion,\n containerConfig: $json.containerConfig,\n hostConfig: $json.hostConfig,\n networkSettings: $json.networkSettings,\n containerName: $json.containerName,\n containerId: $json.containerId,\n chatId: $json.chatId\n }\n};" "jsCode": "// Build pull image command\nconst imageName = $json.imageName;\n\n// Pipe through tail to only keep last 10KB - avoids memory issues with large pulls\n// Error/success messages appear at the end of the stream\nreturn {\n json: {\n cmd: `curl -s --max-time 600 --unix-socket /var/run/docker.sock -X POST 'http://localhost/v1.47/images/create?fromImage=${encodeURIComponent(imageName)}' | tail -c 10000`,\n imageName,\n currentImageId: $json.currentImageId,\n currentVersion: $json.currentVersion,\n containerConfig: $json.containerConfig,\n hostConfig: $json.hostConfig,\n networkSettings: $json.networkSettings,\n containerName: $json.containerName,\n containerId: $json.containerId,\n chatId: $json.chatId\n }\n};"
}, },
"id": "code-build-pull-cmd", "id": "code-build-pull-cmd",
"name": "Build Pull Command", "name": "Build Pull Command",