mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-22 15:02:23 +00:00
Correctly compare container image name on cleanup
Docker 1.10 sends containerInfo.Image without the ":latest", so the image name doesn't match the app's imageId. This fix first splits the image name into repo and tag and then rebuilds it to include ":latest" when appropriate. Should avoid removing containers when using resin-sync.
This commit is contained in:
parent
131f7f5b22
commit
7104806ad1
@ -1,3 +1,4 @@
|
|||||||
|
* Correctly compare container image name on cleanup [Pablo]
|
||||||
* Log useful supervisor info to stdout/stderr [Kostas]
|
* Log useful supervisor info to stdout/stderr [Kostas]
|
||||||
|
|
||||||
# v1.10.0
|
# v1.10.0
|
||||||
|
@ -200,13 +200,16 @@ do ->
|
|||||||
docker.listContainersAsync(all: true)
|
docker.listContainersAsync(all: true)
|
||||||
.filter (containerInfo) ->
|
.filter (containerInfo) ->
|
||||||
# Do not remove user apps.
|
# Do not remove user apps.
|
||||||
if _.contains(appTags, containerInfo.Image)
|
getRepoAndTag(containerInfo.Image)
|
||||||
return false
|
.then ({ repo, tag }) ->
|
||||||
if _.contains(locallyCreatedTags, containerInfo.Image)
|
repoTag = buildRepoTag(repo, tag)
|
||||||
return false
|
if _.contains(appTags, repoTag)
|
||||||
if !_.contains(supervisorTags, containerInfo.Image)
|
return false
|
||||||
return true
|
if _.contains(locallyCreatedTags, repoTag)
|
||||||
return containerHasExited(containerInfo.Id)
|
return false
|
||||||
|
if !_.contains(supervisorTags, repoTag)
|
||||||
|
return true
|
||||||
|
return containerHasExited(containerInfo.Id)
|
||||||
.map (containerInfo) ->
|
.map (containerInfo) ->
|
||||||
docker.getContainer(containerInfo.Id).removeAsync()
|
docker.getContainer(containerInfo.Id).removeAsync()
|
||||||
.then ->
|
.then ->
|
||||||
|
Loading…
Reference in New Issue
Block a user