File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
components/workspace-cleaner/src Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,17 @@ const labelFilterExpr = {
77} ;
88
99async function cleanup ( ) {
10- const containersToRemove = await docker . listContainers ( { filters : labelFilterExpr } ) ; ;
10+ const containersToRemove = await docker . listContainers ( { filters : labelFilterExpr , all : true } ) ;
1111
1212 if ( containersToRemove . length > 0 ) {
1313 console . log ( `Found ${ containersToRemove . length } containers to remove.` ) ;
1414 for ( const containerInfo of containersToRemove ) {
1515 const container = docker . getContainer ( containerInfo . Id ) ;
16+ const containerDetails = await container . inspect ( ) ;
1617 try {
17- await container . stop ( ) ;
18+ if ( containerDetails . State . Running ) {
19+ await container . stop ( ) ;
20+ }
1821 await container . remove ( ) ;
1922 console . log ( `Removed container ${ containerInfo . Id } ` ) ;
2023 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments