sonic-buildimage/.azure-pipelines/template-clean-sonic-slave.yml
Lawrence Lee 0f488a8cb6
[azp]: Fix type in slave container cleanup (#10424)
Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
2022-04-01 16:22:54 +08:00

9 lines
376 B
YAML

steps:
- script: |
containers=$(docker container ls -a | grep "sonic-slave" | awk '{ print $1 }')
[ -n "$containers" ] && docker container rm -f $containers
docker images | grep "^<none>" | awk '{print$3}' | xargs -i docker rmi {}
images=$(docker images 'sonic-slave-*' -a -q)
[ -n "$images" ] && docker rmi -f $images
displayName: 'Cleanup sonic slave'