Docker Command Cheat Sheet

Listen to this Post

You Should Know:

Here are some essential Docker commands to help you manage containers, images, and networks efficiently:

1. List all running containers:

docker ps

2. List all containers (including stopped ones):

docker ps -a

3. Pull an image from Docker Hub:

docker pull <image_name>

4. Run a container from an image:

docker run <image_name>

5. Run a container in detached mode:

docker run -d <image_name>

6. Stop a running container:

docker stop <container_id>

7. Remove a stopped container:

docker rm <container_id>

8. Remove an image:

docker rmi <image_id>

9. View logs of a container:

docker logs <container_id>

10. Execute a command in a running container:

docker exec -it <container_id> <command>

11. Build a Docker image from a Dockerfile:

docker build -t <image_name> .

12. List all Docker networks:

docker network ls

13. Inspect a Docker network:

docker network inspect <network_name>

14. Prune unused Docker objects:

docker system prune

15. View Docker disk usage:

docker system df

What Undercode Say:

Docker is an essential tool for modern DevOps and cybersecurity practices. Mastering Docker commands allows you to efficiently manage containers, which are crucial for deploying and testing applications in isolated environments. Whether you’re a penetration tester or a developer, understanding Docker can significantly enhance your workflow. For more advanced Docker usage, consider exploring Docker Compose for multi-container applications and Docker Swarm for container orchestration.

Related URLs:

References:

Reported By: Zlatanh Docker – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

Whatsapp
TelegramFeatured Image