MCPcopy Create free account
hub / github.com/vercel/vercel / assertDockerAvailable

Function assertDockerAvailable

packages/container/src/dev.ts:341–365  ·  view source on GitHub ↗

* Verify the Docker daemon is installed and reachable before doing any build * or run work, so the user gets one clear message instead of a cryptic exit * code from whichever Docker command happened to run first. `docker info` * connects to the daemon and exits non-zero (125) when it can't.

(out: DevOutput)

Source from the content-addressed store, hash-verified

339 * connects to the daemon and exits non-zero (125) when it can't.
340 */
341async function assertDockerAvailable(out: DevOutput): Promise<void> {
342 try {
343 await runForwarded(
344 'docker',
345 ['info', '--format', '{{.ServerVersion}}'],
346 out,
347 {
348 quiet: true,
349 }
350 );
351 } catch (err) {
352 const message = (err as Error).message ?? '';
353 if (/command not found/i.test(message)) {
354 throw new Error(
355 'Docker is required for `vercel dev` with containers, but the ' +
356 '`docker` command was not found. Install Docker and ensure it is ' +
357 'on your PATH.'
358 );
359 }
360 throw new Error(
361 'Could not connect to the Docker daemon. Start Docker (e.g. open ' +
362 'Docker Desktop) and run `vercel dev` again.'
363 );
364 }
365}
366
367/**
368 * Build a helpful error for a `docker run` that exited before the container

Callers 1

startContainerFunction · 0.85

Calls 2

runForwardedFunction · 0.85
testMethod · 0.80

Tested by

no test coverage detected