Join us on Facebook!
— Written by Triangles on October 05, 2017 • updated on October 05, 2017 • ID 58 —
All the best Docker commands that I keep forgetting.
| Action | Command |
|---|---|
| Show all images | docker images -a |
| Delete all images | docker rmi $(docker images -a -q) |
| Pull remote image | docker pull <image> |
| Action | Command |
|---|---|
| Show all running containers | docker ps |
| Show all running and stopped containers | docker ps -a |
| Stop all containers | docker stop $(docker ps -a -q) |
| Delete all containers | docker rm $(docker ps -a -q) |
| Create and run a new container | docker run <image tag> <commands> |
| Create a new container without running it | docker create <image tag> <commands> |
| Run an existing container | docker start <container id> |
| Run an existing container with STDIN, STDOUT and STDERR | docker start -a -i <container id> |
| Action | Command |
|---|---|
| Build a Dockerfile | docker build -t <image tag> <Dockerfile> |