Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion bin/lib/nim.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,15 @@ function nimStatusByName(name) {

let healthy = false;
if (state === "running") {
const health = runCapture(`curl -sf http://localhost:8000/v1/models 2>/dev/null`, {
// Resolve the host port dynamically instead of assuming 8000.
// The container always listens on 8000 internally, but the host
// mapping is configurable via startNimContainer(... port).
const rawHostPort = runCapture(
`docker inspect --format '{{(index (index .NetworkSettings.Ports "8000/tcp") 0).HostPort}}' ${shellQuote(name)} 2>/dev/null`,
{ ignoreError: true }
);
const hostPort = /^\d+$/.test(rawHostPort) ? Number(rawHostPort) : 8000;
const health = runCapture(`curl -sf http://localhost:${hostPort}/v1/models 2>/dev/null`, {
ignoreError: true,
});
healthy = !!health;
Expand Down