# Docker for DevOps Engineers.

## Day 16 Task: Docker for DevOps Engineers.

### Docker:

Docker is a software platform that allows you to build, test, and deploy applications quickly. Docker packages software into standardized units called containers that have everything the software needs to run including libraries, system tools, code, and runtime. Using Docker, you can quickly deploy and scale applications into any environment and know your code will run.

Docker is a platform and technology for building, shipping, and running distributed applications in containers. Containers are lightweight, portable, and self-sufficient executable packages that include all the necessary dependencies to run a piece of software. Docker allows developers to package their applications and dependencies into a single container, which can then be easily deployed and run on any host with Docker installed. This allows for consistent and predictable behavior across different environments and reduces the "works on my machine" problem.

### Tasks:

1.  Use the docker run command to start a new container and interact with it through the command line.

* docker run command is used to create a new container.
    

![No alt text provided for this image](https://media.licdn.com/dms/image/D5612AQGUFi0B6Sg1GQ/article-inline_image-shrink_1500_2232/0/1692466078657?e=1700092800&v=beta&t=9XjrHlITBbSu98tHRxlFzJUAXzvO8HyXEWZ0ftdlbMI align="left")

2.  Use the docker inspect command to view detailed information about a container or image.

The “docker inspect” command allows you to view detailed information about a container. This information includes the container’s configuration, network setting, and current state. To use the command, you need to specify the container ID or name as an argument.

![No alt text provided for this image](https://media.licdn.com/dms/image/D5612AQFgforcCO_3KA/article-inline_image-shrink_1500_2232/0/1692466131244?e=1700092800&v=beta&t=deZROMcn7kbqF2IbHNNcZHaFiV5MOSe1v2eyHQ8emhg align="left")

3. Use the docker port command to list the port mappings for a container.

The “docker port” command allows you to list the port mappings for a container. To use the command, you need to specify the ID or name as an argument.

![No alt text provided for this image](https://media.licdn.com/dms/image/D5612AQF0HAseTCjPfg/article-inline_image-shrink_1500_2232/0/1692466145200?e=1700092800&v=beta&t=-XVHQ_MhG7ZIWLzfzslfwj9RaFeDQIPWVGCoJP-Dw3w align="left")

4. Use the docker stats command to view resource usage statistics for one or more containers.

The “docker stats” command allows you to view resources usage statistics for one or more running containers. The command shows a live stream of resources usage statistics for the specified containers, including CPU, memory, network, and storage usage. By default, “docker stats” show statistics for all running containers.

![No alt text provided for this image](https://media.licdn.com/dms/image/D5612AQEJOfjxOLuKfQ/article-inline_image-shrink_1500_2232/0/1692466177111?e=1700092800&v=beta&t=H7KCI8H-TOTrzs7Cc3gw5Jv3o66eRt8XULgnQH7LtA4 align="left")

5. Use the docker top command to view the processes running inside a container.

The “docker top” command allows you to view the processes running inside a container. It is similar to the “top” command on linux and show the same information, such as process ID, user, CPU usage, and memory usage. To use the command, you need to specify the container ID or name as an argument.

![No alt text provided for this image](https://media.licdn.com/dms/image/D5612AQFCTkpu5wXKmw/article-inline_image-shrink_1500_2232/0/1692466194800?e=1700092800&v=beta&t=_9FkFWZAsg5yS_RO6TfEcpzOmPI2RmZ7CwaBZsmACkQ align="left")

6. Use the docker save command to save an image to a tar archive.

The “docker save” command allows you to save an image to a tar archive. This is useful for creating backups of images or for transferring images between different system. The command takes the image name or ID as an argument and save the image to a tar archive.

![No alt text provided for this image](https://media.licdn.com/dms/image/D5612AQH8ShAB7-nu_Q/article-inline_image-shrink_1500_2232/0/1692466209970?e=1700092800&v=beta&t=lhyd21vIpVXGzJ-GkAsWW-jM0DCesr95E-G74Hg53W0 align="left")

7. Use the docker load command to load an image from a tar archive.

The “docker load” command allows you to load an image from tar archive. This is useful for restoring backups of images or for transferring images between different system. The command takes the file name of the tar archive as an argument and loads the image(S) into the local image store.

![No alt text provided for this image](https://media.licdn.com/dms/image/D5612AQE3gPGM-dnXuA/article-inline_image-shrink_1500_2232/0/1692466223866?e=1700092800&v=beta&t=zOdbC7zpbwtlxxsa9Qjr6fzOLOMGX4clZ7H4MTKAVZQ align="left")

Thank you for reading my acticle.

I hope you find this article helpful.
