Usefull docker commands

From DevOps Notebook
Revision as of 16:03, 29 August 2022 by MilosZ (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Clean up overlay folder

# docker system prune -a -f

or

# docker rm -v $(sudo docker ps -a -q -f status=exited)
# docker rmi -f  $(sudo docker images -f "dangling=true" -q)
# docker volume ls -qf dangling=true | xargs -r docker volume rm


List open sockets inside a running docker container

# docker inspect -f '{{.State.Pid}}' <container_name_or_id>
# nsenter -t <container_name_or_id> -n netstat