Docker CLI Commands
Here is a simple list of the most common Docker commands to help you manage your containers and images. 💻
1. Working with Containers
- Run a container: starts a new container from an image.
Terminal window docker run <image_name> - List running containers:
Terminal window docker ps - List ALL containers (running and stopped):
Terminal window docker ps -a - Stop a running container:
Terminal window docker stop <container_id> - Start a stopped container:
Terminal window docker start <container_id> - Remove a container:
Terminal window docker rm <container_id>
2. Working with Images
- List all images on your computer:
Terminal window docker images - Download (pull) an image from Docker Hub:
Terminal window docker pull <image_name> - Remove an image:
Terminal window docker rmi <image_name>
3. Cleaning Up
- Remove all stopped containers, unused networks, and dangling images:
Terminal window docker system prune
Pro Tip
If you are ever stuck, you can always type docker --help or docker <command> --help to see what options are available! 💡