--------
delete dangling docker images :
docker rmi $(sudo docker images --filter "dangling=true" -q --no-trunc)
--------
Delete stopped containers ( and not running containers):
docker rm $(docker ps -a -q)
--------
Delete
untagged docker images :
docker rmi `docker images | grep "^<none>" | awk '{print $3}' ` --force
If no force is used, it throws error "i
mage is being used by stopped container"---------
# To delete a image remotely, and it has s3-apb as its name:
ssh remotee_server 'docker rmi `docker images | grep s3-apb | awk '"'"'{print $3}'"'"' ` --force'
Having double quote with remote command is tricky. it is getting evaluated as part of local shell itself. to avoid you need use like above.
source: https://stackoverflow.com/questions/20498599/how-to-escape-the-single-quote-character-in-an-ssh-remote-bash-command
No comments:
Post a Comment