Skip to content
6 changes: 6 additions & 0 deletions src/lib/inference/vllm-serving-port.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,12 @@ describe("managed vLLM serving-port guard (#8685)", () => {
MANAGED_CONTAINER_ID,
expect.objectContaining({ ignoreError: true, suppressOutput: true }),
);
expect(mocks.dockerCapture).toHaveBeenCalledWith(
["port", MANAGED_CONTAINER_ID, "8000"],
expect.objectContaining({
env: expect.objectContaining({ DOCKER_CONTEXT: "default" }),
}),
);
expect(mocks.dockerRunDetached).toHaveBeenCalled();
expect(errSpy.mock.calls.flat().join("\n")).not.toContain("another process");
const dockerOptions = [
Expand Down
4 changes: 3 additions & 1 deletion src/lib/inference/vllm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1975,7 +1975,9 @@ function adoptableServingPortHolder(
const ownership = inspectVllmContainerOwnershipInDockerEnv(containerName, dockerEnv);
if (ownership.kind !== "managed" || !ownership.running) return undefined;
// The managed container always publishes the fixed container port 8000.
const published = dockerCapture(["port", containerName, "8000"], {
// Keep the binding lookup pinned to the identity that passed ownership
// inspection. The fixed name can change hands between Docker commands.
const published = dockerCapture(["port", ownership.containerId, "8000"], {
env: dockerEnv,
ignoreError: true,
timeout: 10_000,
Expand Down