Skip to content

Commit

Permalink
provide better help text if docker daemon is not running
Browse files Browse the repository at this point in the history
  • Loading branch information
echo-bravo-yahoo committed Dec 13, 2024
1 parent d2fa949 commit edae8cf
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions src/lib/docker-containers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,28 @@ export async function ensureContainerRunning({
color: _color,
}) {
color = _color;
if (pull) {
await pullImage(IMAGE_NAME);
let logStream;
try {
if (pull) {
await pullImage(IMAGE_NAME);
}
logStream = await startContainer({
imageName: IMAGE_NAME,
containerName,
hostIp,
hostPort,
containerPort,
});
} catch (error) {
if (error.message.includes("connect ENOENT /var/run/docker.sock")) {
throw new CommandError(
"Could not connect to docker daemon. Please ensure that it is currently running.",
);
} else {
throw error;
}
}
const logStream = await startContainer({
imageName: IMAGE_NAME,
containerName,
hostIp,
hostPort,
containerPort,
});

stderr(
`[StartContainer] Container '${containerName}' started. Monitoring HealthCheck for readiness.`,
);
Expand Down

0 comments on commit edae8cf

Please sign in to comment.