In RedHat based OS, docker containers will be kept in ~/.local/share/containers/storage
by default.
du -sh ~/.local/share/containers/storage 2> >(grep -v 'Permission denied') | sort -n
docker ps -a -q --filter ancestor=[containerName]
docker ps -a -q --filter "ancestor=[containerName]" --filter "status=exited"
docker rm $(docker ps -a -q --filter "ancestor=[containerName]" --filter "status=exited")
docker images -q --filter "dangling=true"
- notice this is not an exact match
docker images --filter "reference=[imageName]:[imageTag]"
docker rmi $(docker images -q [any filter])
docker system df
docker system prune
docker builder prune
podman volume rm --all
In case you're getting an error running a container, which might expect environment variable, or run an executalbe, you could debug it by changing the entrypoint:
podman run -d --entrypoint "/bin/bash" [image_ID] -c 'while true; do echo sleeping; sleep 2; done'
If you're getting an error of:
Error: unable to find user default: no matching entries in passwd file
you'll need to specify the user:
podman run -d --user [username/id] --entrypoint "/bin/bash" [image_ID] -c 'while true; do echo sleeping; sleep 2; done'