Difference between revisions of "Usefull docker commands"

From DevOps Notebook
(Created page with "=== Clean up overlay folder === <pre> # docker system prune -a -f </pre> or <pre> # docker rm -v $(sudo docker ps -a -q -f status=exited) # docker rmi -f $(sudo docker images...")
 
 
Line 8: Line 8:
 
# docker rmi -f  $(sudo docker images -f "dangling=true" -q)
 
# docker rmi -f  $(sudo docker images -f "dangling=true" -q)
 
# docker volume ls -qf dangling=true | xargs -r docker volume rm
 
# docker volume ls -qf dangling=true | xargs -r docker volume rm
 +
</pre>
 +
 +
 +
=== List open sockets inside a running docker container ===
 +
<pre>
 +
# docker inspect -f '{{.State.Pid}}' <container_name_or_id>
 +
# nsenter -t <container_name_or_id> -n netstat
 
</pre>
 
</pre>

Latest revision as of 16:03, 29 August 2022

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