🛳️ Docker Series: Episode 5 — Docker CLI Cheat Sheet: 15 Commands You’ll Actually Use

🎬 “You’ve built your first Docker image — high five! 🖐️ Now it’s time to command Docker like a boss. No more googling basic commands. Here’s your go-to cheat sheet, packed with real examples.”

🧠 Why Learn Docker CLI?

GUI tools are fine…


This content originally appeared on DEV Community and was authored by Yash Sonawane

🎬 "You've built your first Docker image — high five! 🖐️ Now it's time to command Docker like a boss. No more googling basic commands. Here’s your go-to cheat sheet, packed with real examples."

🧠 Why Learn Docker CLI?

GUI tools are fine, but the real power of Docker lies in the terminal. If you want to:

  • Automate workflows
  • Debug faster
  • Build better CI/CD pipelines

Then mastering the Docker CLI is non-negotiable. Let’s dive into the commands that matter.

🚀 Image Commands

📦 1. docker pull

Download an image from Docker Hub.

docker pull node:18

📦 2. docker images

List all downloaded images.

docker images

🧹 3. docker rmi

Remove an image.

docker rmi node:18

🧪 Container Commands

🏃 4. docker run

Run a container from an image.

docker run -d -p 3000:3000 my-node-app

🧭 5. docker ps

List running containers.

docker ps

👁️ 6. docker ps -a

List all containers (including stopped ones).

docker ps -a

🛑 7. docker stop

Stop a running container.

docker stop <container_id>

❌ 8. docker rm

Remove a container.

docker rm <container_id>

🔍 Debugging & Logs

📜 9. docker logs

View logs from a container.

docker logs <container_id>

🐚 10. docker exec

Run a command inside a running container.

docker exec -it <container_id> bash

🔎 11. docker inspect

View detailed info (network, config, volumes, etc.).

docker inspect <container_id>

🛠️ Image Building & Tagging

🧱 12. docker build

Build a Docker image from a Dockerfile.

docker build -t my-node-app .

🏷️ 13. docker tag

Tag an image for pushing to Docker Hub.

docker tag my-node-app yashsonawane/my-node-app:latest

☁️ 14. docker push

Push an image to Docker Hub.

docker push yashsonawane/my-node-app:latest

🧹 Cleanup Commands

🧽 15. docker system prune

Remove all unused data — WARNING: this will free space aggressively.

docker system prune

📌 Pro Tips

  • Use -it for interactive terminals (bash, sh, etc.)
  • Use container/image names instead of long IDs
  • Keep a .dockerignore file to reduce image size

🧠 What’s Next?

In Episode 6, we’ll cover:

  • Docker Volumes: Why data disappears when you stop containers
  • How to persist data like a pro
  • Real use cases (MySQL, logs, etc.)

💬 Over to You

What’s your favorite Docker command?
What confused you the most when using the CLI for the first time?

Drop it in the comments — let’s learn from each other!

❤️ If this cheat sheet helped, give it a like, bookmark it, or share it with your fellow devs.

🎬 Next: “Docker Volumes — The Secret to Saving Your Data”


This content originally appeared on DEV Community and was authored by Yash Sonawane


Print Share Comment Cite Upload Translate Updates
APA

Yash Sonawane | Sciencx (2025-08-27T02:37:00+00:00) 🛳️ Docker Series: Episode 5 — Docker CLI Cheat Sheet: 15 Commands You’ll Actually Use. Retrieved from https://www.scien.cx/2025/08/27/%f0%9f%9b%b3%ef%b8%8f-docker-series-episode-5-docker-cli-cheat-sheet-15-commands-youll-actually-use/

MLA
" » 🛳️ Docker Series: Episode 5 — Docker CLI Cheat Sheet: 15 Commands You’ll Actually Use." Yash Sonawane | Sciencx - Wednesday August 27, 2025, https://www.scien.cx/2025/08/27/%f0%9f%9b%b3%ef%b8%8f-docker-series-episode-5-docker-cli-cheat-sheet-15-commands-youll-actually-use/
HARVARD
Yash Sonawane | Sciencx Wednesday August 27, 2025 » 🛳️ Docker Series: Episode 5 — Docker CLI Cheat Sheet: 15 Commands You’ll Actually Use., viewed ,<https://www.scien.cx/2025/08/27/%f0%9f%9b%b3%ef%b8%8f-docker-series-episode-5-docker-cli-cheat-sheet-15-commands-youll-actually-use/>
VANCOUVER
Yash Sonawane | Sciencx - » 🛳️ Docker Series: Episode 5 — Docker CLI Cheat Sheet: 15 Commands You’ll Actually Use. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/08/27/%f0%9f%9b%b3%ef%b8%8f-docker-series-episode-5-docker-cli-cheat-sheet-15-commands-youll-actually-use/
CHICAGO
" » 🛳️ Docker Series: Episode 5 — Docker CLI Cheat Sheet: 15 Commands You’ll Actually Use." Yash Sonawane | Sciencx - Accessed . https://www.scien.cx/2025/08/27/%f0%9f%9b%b3%ef%b8%8f-docker-series-episode-5-docker-cli-cheat-sheet-15-commands-youll-actually-use/
IEEE
" » 🛳️ Docker Series: Episode 5 — Docker CLI Cheat Sheet: 15 Commands You’ll Actually Use." Yash Sonawane | Sciencx [Online]. Available: https://www.scien.cx/2025/08/27/%f0%9f%9b%b3%ef%b8%8f-docker-series-episode-5-docker-cli-cheat-sheet-15-commands-youll-actually-use/. [Accessed: ]
rf:citation
» 🛳️ Docker Series: Episode 5 — Docker CLI Cheat Sheet: 15 Commands You’ll Actually Use | Yash Sonawane | Sciencx | https://www.scien.cx/2025/08/27/%f0%9f%9b%b3%ef%b8%8f-docker-series-episode-5-docker-cli-cheat-sheet-15-commands-youll-actually-use/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.