Adds Docker cleanup step to pipeline
Adds a Docker cleanup script to the pipeline to remove stopped containers, dangling images, unused networks, and unused volumes. This helps to free up disk space and prevent potential resource exhaustion during automated testing.
This commit is contained in:
parent
ff1b746a99
commit
636ad2bbd0
1 changed files with 26 additions and 0 deletions
|
|
@ -44,6 +44,32 @@ stages:
|
||||||
shardNumber: 4
|
shardNumber: 4
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- script: |
|
||||||
|
echo "Starting Docker cleanup to free space..."
|
||||||
|
|
||||||
|
# Remove all stopped containers
|
||||||
|
echo "Removing stopped containers..."
|
||||||
|
docker container prune -f
|
||||||
|
|
||||||
|
# Remove dangling images (untagged)
|
||||||
|
echo "Removing dangling images..."
|
||||||
|
docker image prune -f
|
||||||
|
|
||||||
|
# Remove unused networks
|
||||||
|
echo "Removing unused networks..."
|
||||||
|
docker network prune -f
|
||||||
|
|
||||||
|
# Remove unused volumes
|
||||||
|
echo "Removing unused volumes..."
|
||||||
|
docker volume prune -f
|
||||||
|
|
||||||
|
# Show disk usage after cleanup
|
||||||
|
echo "Docker system usage after cleanup:"
|
||||||
|
docker system df
|
||||||
|
|
||||||
|
echo "Docker cleanup completed!"
|
||||||
|
displayName: "Docker Cleanup"
|
||||||
|
|
||||||
- task: Docker@2
|
- task: Docker@2
|
||||||
displayName: "Build Docker Image"
|
displayName: "Build Docker Image"
|
||||||
inputs:
|
inputs:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue