Day 16 - 90daysofdevops Challenge : Docker for DevOps Engineers
Prakash Bohara
Immediate Joiner | #Engineer Devops ?? | MySQL | LINUX ??| Git/GitHub?? | AWS ? | DOCKER ??| KUBERNETES ?? | TERRAFORM ??? | JENKINS | ANSIBLE??| EKS/GKE
What is Docker and Why we need Docker?
==> Docker is a platform for building, running, managing, and distributing applications. It is based on the concept of containers, which are lightweight, self-contained environments that package an application and all of its dependencies together. This makes it easy to deploy and run applications consistently across different environments, from local development machines to production servers.
Docker is a popular tool for developers and DevOps teams because it provides several benefits, including:
Common Use Cases of Docker:
--------------------------------------------------------------------------
Tasks
Use the docker run command to start a new container and interact with it through the command line. [Hint: docker run hello-world]
==> The docker run command is the primary command for launching containers in Docker. It takes a variety of options to specify the container's image, command, environment variables, ports, volumes, and other settings.
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
docker run -d hello-world latest
docker run hello-world
Use the docker inspect command to view detailed information about a container or image.
==> The docker inspect command is used to inspect the details of a Docker object, such as a container, image, volume, network, or service. It provides detailed information about the object, including its configuration, state, and resources.
The basic syntax for the docker inspect command is as follows:
docker inspect OBJECT_ID...
Use the docker port command to list the port mappings for a container.
==> The docker port command is used to list all of the ports that are currently exposed for a container. It can also be used to check whether a specific port is exposed for a container.
The basic syntax for the docker port command is as follows:
docker port [CONTAINER_ID]
Use the docker stats command to view resource usage statistics for one or more containers.
==> The docker stats command is used to display a live stream of container resource usage statistics. It provides information about the CPU, memory, network, and disk usage of all running containers.
The basic syntax for the docker stats command is as follows:
领英推荐
docker stats [OPTIONS] [CONTAINER...]
Use the docker top command to view the processes running inside a container.
==> The docker top command is used to display a list of running processes within a Docker container. It provides information about the process ID (PID), user ID (UID), command name, CPU usage, memory usage, and status of each process.
The basic syntax for the docker top command is as follows:
docker top CONTAINER [ps OPTIONS]
Use the docker save command to save an image to a tar archive.
==> The docker save command is used to save a Docker image to a tar archive. This can be useful for backing up an image, transferring it to another machine, or using it with other Docker tools.
The basic syntax for the docker save command is as follows:
docker save [OPTIONS] IMAGE [IMAGE...]
Saving a Single Image
To save a single image to a tar archive, you can use the following command:
docker save my-image > my-image.tar
Use the docker load command to load an image from a tar archive.
==> The docker load command is used to load a Docker image from a tar archive. This is useful for importing images that you have saved or exported from another machine.
The basic syntax for the docker load command is as follows:
docker load [OPTIONS] [FILE]...
Loading an Image from a Tar Archive
To load an image from a tar archive, you can use the following command:
docker load < my-image.tar
OR
docker load -i my-image.tar
I hope you find the blog/article helpful.
??????? #DevOps #container#Automation #CloudServices #docker
#90daysofdevops?#90dayslearningchallenge?#90days?#devops?#devopsengineer?#devopscommunity?#development?#awsdevops??#trainwithshubham?#docker
Thanks for reading and happy learning! ??