Skip to content

Instantly share code, notes, and snippets.

@hacker-volodya
Created December 2, 2023 07:18
Show Gist options
  • Save hacker-volodya/87ef2841876e88052759817970fd0fc4 to your computer and use it in GitHub Desktop.
Save hacker-volodya/87ef2841876e88052759817970fd0fc4 to your computer and use it in GitHub Desktop.
Stop all docker containers
for i in /var/lib/docker/containers/*/config.v2.json; do
touch "$i.new" && getfacl -p "$i" | setfacl --set-file=- "$i.new"
cat "$i" | jq -c '.State.Running = false' > "$i.new" && mv -f "$i.new" "$i"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment