Introduction↓
Docker commands are the building blocks for managing containers efficiently. This are Basic to Intermidiate Commands , providing real-time examples for a comprehensive understanding.
Basic Container Management 🚢
1. Create Docker Image
docker images [OPTIONS] [REPOSITORY[:TAG]]
2. Show Running Containers
docker ps
3. Start a Docker Container
docker start <container id>
4. Stop a Docker Container
docker stop <container id>
5. Run a Docker Image
docker run <image name>
6. View Console Output
docker logs <container id>
Intermediate Container Operations 🔄
7. Delete Stopped Containers
docker rm $(docker ps -a -q)
8. Delete All Images
docker rmi $(docker images -q)
9. SSH into a Running Container
sudo docker exec -it <container name> bash
10. Map Host Port to Container Port
docker run -p <host port>:<container port> <image name>
Conclusion
This extended Docker cheat sheet covers a range of commands, from basic container management to Intermidiate Dockerfile configurations and real-world use cases. Whether you are a beginner or an experienced DevOps engineer, these commands and examples will enhance your Docker proficiency.
Happy Learning! 🐳🚀