Wednesday, November 27, 2019

Remove all from docker

1. Remove all in docker.
# Stop all containers
docker stop `docker ps -qa`

# Remove all containers
docker rm `docker ps -qa`

# Remove all images
docker rmi -f `docker images -qa`

# Remove all volumes
docker volume rm $(docker volume ls -qf dangling="true")

# Remove all networks
docker network rm `docker network ls -q`

# Your installation should now be all fresh and clean.

# The following commands should not output any items:
# docker ps -a
# docker images -a
# docker volume ls

# The following command show only show the default networks:
# docker network ls

source https://gist.github.com/beeman/aca41f3ebd2bf5efbd9d7fef09eac54d

2. Debug in docker
# method 1
docker run -it image_id bash

No comments: