Hello everyone! Time is everything in DevOps processes and the daily development hustle. When working with container architectures, sometimes solving complex problems with a single line is a lifesaver. Today, I'm sharing the essential Docker commands I use most in my daily workflow that speed up my work incredibly. Without getting into long theoretical explanations, let's get straight to the bite-sized info that will work for you.

  • docker system prune -a: Instantly frees up space on your disk by cleaning up all unused stopped containers, networks, images, and caches at once.
  • docker exec -it <container_id> /bin/bash: Allows you to enter a running container at the terminal level to run commands directly inside and debug.
  • docker logs -f <container_id>: Makes it easier to catch errors in seconds by allowing you to follow the logs generated by the container instantly and live.
  • docker ps -a: Quickly lists the current status of all containers on your system, including not only running ones but also stopped ones.
  • docker inspect <container_id>: Allows you to dump all low-level configuration details of the related container, such as IP address, environment variables, and network settings, in JSON format.
  • docker compose up -d: Silently spins up your multi-service projects in the background (detached mode) and doesn't occupy your terminal.
  • docker stop $(docker ps -q): In emergencies or when you want to reset the environment, stops all running containers on the system in a single move.
  • docker rm $(docker ps -a -q): Helps you quickly tidy up your development environment by completely deleting all stopped containers from the system.
  • docker stats: Allows you to see the instant CPU, RAM, and network usage metrics of your running containers like a live resource monitoring screen.
  • docker port <container_id>: Helps you quickly check which ports the services inside the container are mapped to on the outside (host machine).

I hope these commands speed up your daily workflow too and save your life in potential moments of crisis. What is your favorite Docker command that you use the most? Don't forget to share it with me, wishing you seamless deploys!