Skip to content

Commit df59dc3

Browse files
Update common Docker engineering infrastructure with latest (dotnet#255)
1 parent d706126 commit df59dc3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

eng/common/Invoke-CleanupDocker.ps1

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ docker ps -a -q | ForEach-Object { docker rm -f $_ }
55

66
docker volume prune -f
77

8-
# Preserve the Windows base images and the common eng infra images (e.g. ImageBuilder)
8+
# Preserve the tagged Windows base images and the common eng infra images (e.g. ImageBuilder)
99
# to avoid the expense of having to repull continuously.
1010
$engInfraImages = Get-Content ./eng/common/templates/variables/docker-images.yml |
1111
Where-Object { $_.Trim() -notlike 'variables:' } |
@@ -14,7 +14,8 @@ $engInfraImages = Get-Content ./eng/common/templates/variables/docker-images.yml
1414
docker images --format "{{.Repository}}:{{.Tag}} {{.ID}}"|
1515
Where-Object {
1616
$localImage = $_
17-
-Not ($localImage.StartsWith("mcr.microsoft.com/windows")`
17+
$localImage.Contains(":<none> ")`
18+
-Or -Not ($localImage.StartsWith("mcr.microsoft.com/windows")`
1819
-Or ($engInfraImages.Where({ $localImage.StartsWith($_) }, 'First').Count -gt 0)) } |
1920
ForEach-Object { $_.Split(' ', [System.StringSplitOptions]::RemoveEmptyEntries)[1] } |
2021
Select-Object -Unique |

eng/common/templates/steps/cleanup-docker-linux.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ steps:
1717
continueOnError: true
1818
- script: >
1919
docker run --rm $(dockerArmRunOptions) --entrypoint /bin/bash $(dockerClientImage) -c
20-
'docker rmi -f $(docker images --format "{{.Repository}}:{{.Tag}}" | grep -v -e ^arm32v7/ -e ^arm64v8/ -e ^mcr\\.microsoft\\.com/windows)'
20+
'docker rmi -f $(docker images --format "{{.Repository}}:{{.Tag}}" | grep -v -e ^arm32v7/ -e ^arm64v8/ -e ^mcr\\.microsoft\\.com/windows -e :\<none\>$)'
2121
displayName: Cleanup Remote Docker Server (images)
2222
condition: always()
2323
continueOnError: true

0 commit comments

Comments
 (0)