-
-
Save SergeyKozlov/d260d366ca740b85a82e2fa6ec7d885c to your computer and use it in GitHub Desktop.
Docker Swarm - Remove all Down nodes automatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Requirements: linux, docker, grep, awk | |
# This script removes all "Down" (off) nodes from Docker Swarm | |
# Useful to clean stuff from time to time, if you have auto-joining nodes for example | |
sudo docker node rm $(sudo docker node ls | grep Down | awk -F" " '{ print $1 }') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment