Skip to main content

Command Palette

Search for a command to run...

Day 16 Task: Docker for DevOps Engineers

Published
2 min read
A

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

  1. Run a New Container
    To start by running a simple Docker container, use the following command:

     docker run hello-world
    

    This command pulls the hello-world image from Docker Hub (if not already available locally) and runs it. It’s a great way to verify your Docker installation.

  2. 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.

  3. 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.

  4. View Resource Usage Statistics
    To monitor resource usage (CPU, memory, etc.) of all running containers, use:

     docker stats
    

    This command gives you a real-time view of resource consumption.

  5. 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.

  6. 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.

  7. Load an Image from a Tar Archive
    To load an image from a previously saved tar file, use:

     docker load -i <input_file>.tar
    

    Replace <input_file> with the name of the tar file you want to load.

More from this blog

DevOps Projects and Blog

69 posts

Day 16 Task: Docker for DevOps Engineers