Day 16 Task: Docker for DevOps Engineers
DevOps | Cloud Practitioner | AWS | GIT | Kubernetes | Terraform | ArgoCD | Gitlab
Docker Overview
Docker is a powerful platform that streamlines the process of building, testing, and deploying applications by using containers. Containers encapsulate everything your application needs to run, ensuring consistency across different environments.
Tasks
Run a New Container
To start by running a simple Docker container, use the following command:docker run hello-worldThis command pulls the
hello-worldimage from Docker Hub (if not already available locally) and runs it. It’s a great way to verify your Docker installation.Inspect Container or Image
To view detailed information about a specific container or image, use:docker inspect <container_id_or_image_name>Replace
<container_id_or_image_name>with the actual ID or name of the container or image you want to inspect.List Port Mappings
To check the port mappings of a running container, use:docker port <container_id>Replace
<container_id>with the ID of your running container.View Resource Usage Statistics
To monitor resource usage (CPU, memory, etc.) of all running containers, use:docker statsThis command gives you a real-time view of resource consumption.
View Processes in a Container
To see what processes are running inside a container, use:docker top <container_id>Replace
<container_id>with the ID of the container you want to inspect.Save an Image to a Tar Archive
To save an image to a tar file for backup or transfer, use:docker save -o <output_file>.tar <image_name>Replace
<output_file>with your desired file name and<image_name>with the image you want to save.Load an Image from a Tar Archive
To load an image from a previously saved tar file, use:docker load -i <input_file>.tarReplace
<input_file>with the name of the tar file you want to load.


