# Day 16 - Task: Navigating the Seas of Docker for    DevOps Engineers 🐳🚀 (Dec 12, 2023)

# Tasks

As you have already installed docker in previous days tasks, now is the time to run Docker commands.

* Use the `docker run` command to start a new container and interact with it through the command line. \[Hint: docker run hello-world\]
    
* Use the `docker inspect` command to view detailed information about a container or image.
    
* Use the `docker port` command to list the port mappings for a container.
    
* Use the `docker stats` command to view resource usage statistics for one or more containers.
    
* Use the `docker top` command to view the processes running inside a container.
    
* Use the `docker save` command to save an image to a tar archive.
    
* Use the `docker load` command to load an image from a tar archive.
    

### **Docker: A Brief Overview**

Docker is more than just a buzzword; it's a revolutionary platform that simplifies the deployment, testing, and scaling of applications. How? By packaging software into standardized units called containers. These containers encapsulate everything needed to run an application, from libraries to system tools and code.

With Docker, you can ensure that your application runs consistently across different environments. It provides a level of abstraction that enables you to focus on building and shipping your software rather than dealing with environment-specific issues.

### **Tasks to Set Sail: Docker Commands Exploration ⚓**

#### **1\. Docker Run Command: Setting Sail on Containers**

```plaintext
# Start a new container and interact with it through the command line
docker run hello-world
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1702361010419/8e320c50-d2c5-4bc9-90e3-4439bd95fe69.png align="center")

#### **2\. Docker Inspect Command: Delving into Container Details**

```plaintext
# View detailed information about a container or image
docker inspect <container_id or image_name>
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1702361019704/3ae4f648-ac6d-420f-b53d-f4c18e827556.png align="center")

#### **3\. Docker Port Command: Navigating the Port Map**

```plaintext
# List the port mappings for a container
docker port <container_id>
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1702361278455/954276f3-9182-4890-8946-942bc56e6239.png align="center")

#### **4\. Docker Stats Command: Monitoring Resource Usage**

```plaintext
# View resource usage statistics for one or more containers
docker stats <container_id>
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1702361379921/b2cc5ee6-3b45-408f-b5e6-fc0d1b6788c6.png align="center")

#### **5\. Docker Top Command: Peeking into Container Processes**

```plaintext
# View the processes running inside a container
docker top <container_id>
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1702361388709/af2cc6d4-aa08-4fba-9c9a-a74d9eb6040f.png align="center")

#### **6\. Docker Save and Load Commands: Archiving and Retrieving Images**

```plaintext
# Save an image to a tar archive
docker save -o image.tar <image_name>

# Load an image from a tar archive
docker load -i image.tar
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1702361827146/e41b0393-f856-41ff-883a-c403d8ae1a2a.png align="center")
