![](/style/images/good.png)
0
![](/style/images/bad.png)
Some helpful Docker bits
source link: https://sj14.gitlab.io/post/2020/09-13-some-docker-bits/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
2020-09-13
Shell into a fresh container
Handy for some quick testing.
Debian
docker run -it debian /bin/bash
Alpine
docker run -it alpine /bin/ash
Hostname of the host
When you are inside a docker container, you can use host.docker.internal
for connections to the host machine.
Stop all running containers
docker stop $(docker ps -q)
Remove containers
Remove all stopped containers
docker rm $(docker ps -aq)
Remove all stopped and running containers
docker rm -f $(docker ps -aq)
Docker System Prune
Clean up your host a bit.
docker system prune
Remove all Images
This is not done by docker system prune
and gives your host machine some free space.
docker rmi $(docker images -q)
Remove all volumes
This is also not done by docker system prune
.
docker volume rm $(docker volume ls -q)
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK