fix(docker): Healthcheck über 127.0.0.1 statt localhost (IPv4/IPv6)

Made-with: Cursor
This commit is contained in:
2026-04-18 11:17:56 +02:00
parent 359fc7caee
commit bfb733de5c
3 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ EXPOSE 3000
# Health check # Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })" || exit 1 CMD node -e "require('http').get('http://127.0.0.1:3000/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })" || exit 1
# Start the application with startup script # Start the application with startup script
CMD ["/app/start.sh"] CMD ["/app/start.sh"]
+2 -1
View File
@@ -16,8 +16,9 @@ services:
- "3000:3000" - "3000:3000"
volumes: volumes:
- storage-data:/app/.storage - storage-data:/app/.storage
# localhost kann auf [::1] zeigen, die App lauscht aber nur auf IPv4 (0.0.0.0) → 127.0.0.1
healthcheck: healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/health"] test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:3000/health"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3
+1 -1
View File
@@ -9,7 +9,7 @@ services:
volumes: volumes:
- ./.storage:/app/.storage - ./.storage:/app/.storage
healthcheck: healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/"] test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:3000/"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3