Skip to content

Commit

Permalink
Add flag -a to docker ps and echo
Browse files Browse the repository at this point in the history
  • Loading branch information
yenienserrano committed Jan 30, 2025
1 parent 910f0b3 commit a53f378
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dev-tools/test-packages/test-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ clean() {
# This is done because in the construction of packages arm sometimes fails because it is not finished destroying the container and when trying to delete the image fails because it is in use.
MAX_RETRIES=30
RETRY_COUNT=0
while docker ps --format "{{.Names}}" | grep $CONTAINER_NAME; do
echo "Waiting for the container ($CONTAINER_NAME) to be removed"
while docker ps -a --format "{{.Names}}" | grep $CONTAINER_NAME; do
echo "The $(docker ps -a --format "{{.Names}}" | grep $CONTAINER_NAME) container has not been removed yet. Retry number $RETRY_COUNT."
if [ $RETRY_COUNT -ge $MAX_RETRIES ]; then
echo "WARNING: Maximum retries reached while waiting for container to stop"
break
fi
sleep 2
RETRY_COUNT=$((RETRY_COUNT + 1))
done
echo "Container removed. Removing the image"
docker rmi $CONTAINER_NAME
}

Expand Down

0 comments on commit a53f378

Please sign in to comment.