Skip to content

Instantly share code, notes, and snippets.

@ganezasan
Created August 23, 2020 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ganezasan/8e3355974a7917c4aa4a122d7eee730a to your computer and use it in GitHub Desktop.
Save ganezasan/8e3355974a7917c4aa4a122d7eee730a to your computer and use it in GitHub Desktop.
clean-up-nomad-client

enable drain

$ nomad node-drain -self -enable

manually remove nomad client data file

!#/bin/bash
export NOMAD_DATA_ROOT=/opt/nomad
for ALLOC in `ls -d $NOMAD_DATA_ROOT/alloc/*`; do 
  for JOB in `ls ${ALLOC} | grep -v alloc`; do 
    umount ${ALLOC}/${JOB}/secrets; 
    umount ${ALLOC}/${JOB}/dev; 
    umount ${ALLOC}/${JOB}/proc; 
    umount ${ALLOC}/${JOB}/alloc; 
  done; 
done
rm -Rf $NOMAD_DATA_ROOT

remove all images

docker rmi $(docker images -a -q)

remove all containers

docker rm $(docker ps -a -f status=exited -q)

gc

curl -XPUT http://127.0.0.1:4646/v1/system/gc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment