# Day 20 Task: Docker Cheat Sheet

🐳 **Docker Cheat Sheet: Streamlining Container Operations! 🚀**

Greetings, DevOps enthusiasts! Excited to share a Docker cheat sheet to navigate the container seas efficiently. Let's dive in! 🛠️

### Docker Commands:

1. **Build an Image:**
    
    ```bash
    docker build -t your-image-name:tag .
    ```
    
    *Builds a Docker image from the current directory.*
    
2. **Run a Detached Container:**
    
    ```bash
    docker run -d -p host-port:container-port your-image-name:tag
    ```
    
    *Spins up a detached container, mapping ports for accessibility.*
    
3. **List Running Containers:**
    
    ```bash
    docker ps
    ```
    
    *Displays active containers and their vital details.*
    
4. **Inspect Container Details:**
    
    ```bash
    docker inspect container-id
    ```
    
    *Fetches in-depth information about a specific container.*
    
5. **View Container Logs:**
    
    ```bash
    docker logs container-id
    ```
    
    *Retrieves and displays logs for a specific container.*
    
6. **Stop and Remove Containers:**
    
    ```bash
    docker stop container-id
    docker rm container-id
    ```
    
    *Gracefully stops and removes a running container.*
    

### Bonus Tips:

* **Run Without Sudo:**
    
    ```bash
    sudo usermod -aG docker $USER
    ```
    
    *Enables running Docker commands without sudo.*
    
* **Remove Docker Images:**
    
    ```bash
    docker rmi image-id
    ```
    
    *Deletes a Docker image.*
    

### Conclusion:

Docker is a powerhouse for container orchestration, and mastering these commands empowers efficient operations. Keep this cheat sheet handy for smooth sailing in the containerized world!
