redis/node-redis · error · Error

docker run error - ${stderr}

Error message

docker run error - ${stderr}

What it means

spawnRedisServerDocker runs `docker run -d ...` via execFile. With -d, Docker prints the new container ID to stdout; if stdout is empty the code treats the run as failed and throws, including stderr. This guards against Docker refusing to start the container (daemon down, image missing, name/port conflict).

Source

Thrown at packages/test-utils/lib/dockers.ts:139

  dockerArgs.push(
    '-d',
    '--network', 'host',
    `${options.image}:${options.version}`
  );

  if (serverArguments.length > 0) {
    for (let i = 0; i < serverArguments.length; i++) {
      dockerArgs.push(serverArguments[i])
    }
  }

  console.log(`[Docker] Spawning Redis container - Image: ${options.image}:${options.version}, Port: ${port}, Mode: ${options.mode}`);

  const { stdout, stderr } = await execAsync('docker', dockerArgs);

  if (!stdout) {
    throw new Error(`docker run error - ${stderr}`);
  }

  while (await isPortAvailable(port)) {
    await setTimeout(50);
  }

  return {
    port,
    dockerId: stdout.trim()
  };
}
const RUNNING_SERVERS = new Map<Array<string>, ReturnType<typeof spawnRedisServerDocker>>();

export interface ProxiedRedisServerDocker {
  ports: number[],
  apiPort: number,
  dockerId: string
}

View on GitHub (pinned to 90fd0652bc)

Solutions

  1. Confirm Docker is reachable: docker info (start Docker Desktop / dockerd if it errors)
  2. Pull the image manually to see the real error: docker pull <image>:<version>
  3. Read the full stderr in the thrown message — it usually names the exact Docker refusal (port conflict, image not found, etc.)

Example fix

# before — docker run produced no container id
# stderr in the error tells you why

# after — diagnose then pull
docker info && docker pull redislabs/client-libs-test:7.4
# rerun the test
Defensive patterns

Strategy: validation

Validate before calling

import { execFile } from 'node:child_process';
import { promisify } from 'node:util';
const exec = promisify(execFile);
async function assertDockerReady(imageTag: string): Promise<void> {
  await exec('docker', ['info']);
  try { await exec('docker', ['image', 'inspect', imageTag]); }
  catch { await exec('docker', ['pull', imageTag]); }
}

Try / catch

try {
  await spawnRedisServerDocker(opts, args);
} catch (e) {
  if (e instanceof Error && /docker run error/.test(e.message)) {
  }
  throw e;
}

Prevention

When it happens

Trigger: Docker daemon not running; the configured image:version tag not present and not pullable; a port conflict on the host (the suite uses --network host); Docker Desktop not started.

Common situations: New developer machine without Docker installed/started; CI runner where docker pull of the test image failed silently earlier; image tag bumped but never pulled; another container already bound to the chosen port.

Related errors


AI-assisted analysis of redis/node-redis@90fd0652bc (2026-08-11). Data as JSON: /api/errors/c5d0cb732400d033. Report an issue: GitHub.