Files
Linux-scripts/allscripts1/docker_cleaner.sh

14 lines
448 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# 1. Остановить ВСЕ контейнеры
docker stop $(docker ps -aq) 2>/dev/null
# 2. Удалить ВСЕ контейнеры
docker rm $(docker ps -aq) 2>/dev/null
# 3. Удалить ВСЕ образы (включая используемые)
docker rmi $(docker images -q) 2>/dev/null
# 4. Принудительно удалить остатки (если что-то осталось)
docker image prune -af