Skip to content

Commit 24f28cc

Browse files
committed
Ignore 'already stopped' Docker errors
1 parent 8a93245 commit 24f28cc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/interceptors/docker/docker-commands.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,11 @@ export async function restartAndInjectContainer(
205205
const container = docker.getContainer(containerId);
206206
const containerDetails = await container.inspect();
207207

208-
await container.stop({ t: 1 });
208+
await container.stop({ t: 1 }).catch((e) => {
209+
// Ignore already-stopped errors:
210+
if (e.message?.includes('container already stopped')) return;
211+
else throw e;
212+
});
209213
await container.remove().catch((e) => {
210214
if ([409, 404, 304].includes(e.statusCode)) {
211215
// Generally this means the container was running with --rm, so

0 commit comments

Comments
 (0)