Useful Docker commands
Here are the list of widely used docker commands - consider this to be a cheatsheet!
Usage
Command
Start a container
docker run <image-name>
Start an interactive container
docker run -it <image-name>
Start a detached container
docker run -d <image-name>
Start container with a name
docker run --name <container-name> <image-name>
List running containers
docker ps
Filter running container on name
docker ps -f "name=<container-name>"
Stop a container
docker stop <container-id>
See existing logs for container
docker logs <container-id>
See live logs for container
docker logs -f <container-id>
Exit live log view of container
CTRL+C
Remove stopped container
docker container rm <container-id>
Last updated