Merge pull request #9884 from Fs00/autoremove-containers

Autoremove containers launched by DockerContainerRunner
This commit is contained in:
Patrik Oldsberg
2022-03-03 14:28:04 +01:00
committed by GitHub
3 changed files with 8 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-common': patch
---
DockerContainerRunner.runContainer now automatically removes the container when its execution terminates
@@ -115,6 +115,7 @@ describe('DockerContainerRunner', () => {
Env: envVarsArray,
WorkingDir: workingDir,
HostConfig: {
AutoRemove: true,
Binds: expect.arrayContaining([
`${path.join(rootDir, 'input')}:/input`,
`${path.join(rootDir, 'output')}:/output`,
@@ -207,6 +208,7 @@ describe('DockerContainerRunner', () => {
logStream,
expect.objectContaining({
HostConfig: {
AutoRemove: true,
Binds: [],
},
Volumes: {},
@@ -105,6 +105,7 @@ export class DockerContainerRunner implements ContainerRunner {
await this.dockerClient.run(imageName, args, logStream, {
Volumes,
HostConfig: {
AutoRemove: true,
Binds,
},
...(workingDir ? { WorkingDir: workingDir } : {}),