mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-21 02:01:35 +00:00
Merge pull request #158 from resin-io/157-fix-container-cleanup
Correctly compare container image name on cleanup
This commit is contained in:
commit
9b3381453e
@ -1,3 +1,4 @@
|
||||
* Correctly compare container image name on cleanup [Pablo]
|
||||
* Log useful supervisor info to stdout/stderr [Kostas]
|
||||
|
||||
# v1.10.0
|
||||
|
@ -200,13 +200,16 @@ do ->
|
||||
docker.listContainersAsync(all: true)
|
||||
.filter (containerInfo) ->
|
||||
# Do not remove user apps.
|
||||
if _.contains(appTags, containerInfo.Image)
|
||||
return false
|
||||
if _.contains(locallyCreatedTags, containerInfo.Image)
|
||||
return false
|
||||
if !_.contains(supervisorTags, containerInfo.Image)
|
||||
return true
|
||||
return containerHasExited(containerInfo.Id)
|
||||
getRepoAndTag(containerInfo.Image)
|
||||
.then ({ repo, tag }) ->
|
||||
repoTag = buildRepoTag(repo, tag)
|
||||
if _.contains(appTags, repoTag)
|
||||
return false
|
||||
if _.contains(locallyCreatedTags, repoTag)
|
||||
return false
|
||||
if !_.contains(supervisorTags, repoTag)
|
||||
return true
|
||||
return containerHasExited(containerInfo.Id)
|
||||
.map (containerInfo) ->
|
||||
docker.getContainer(containerInfo.Id).removeAsync()
|
||||
.then ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user