Day 16 :- Docker for DevOps Engineers.

Content :
- What is docker.
Tasks :
As you have already installed docker in previous days tasks, now is the time to run Docker commands.
Use the
docker runcommand to start a new container and interact with it through the command line. [Hint: docker run hello-world]Use the
docker inspectcommand to view detailed information about a container or image.Use the
docker portcommand to list the port mappings for a container.Use the
docker statscommand to view resource usage statistics for one or more containers.Use the
docker topcommand to view the processes running inside a container.Use the
docker savecommand to save an image to a tar archive.Use the
docker loadcommand to load an image from a tar archive.
What is Docker :-
Docker is a platform designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package an application and all its dependencies into a single standardized unit, which can then be easily transported from one environment to another, such as from a developer's laptop to a testing environment, or from a data center to the cloud.
Docker provides a set of tools and a platform for managing containers, including:
Docker Engine: The core technology that allows you to create and manage containers on a single machine.
Docker Compose: A tool for defining and running multi-container Docker applications using a YAML file to configure the application's services and dependencies.
Docker Swarm: A container orchestration tool that allows you to manage a cluster of Docker hosts and deploy services across them.
Docker Hub: A cloud-based repository where users can share and store container images. It also provides various features for managing and automating the lifecycle of containers.
Docker has become popular among developers and DevOps teams because it provides a consistent environment across different platforms and helps to streamline the development, deployment, and scaling of applications. It also promotes the use of microservices architecture and supports modern software development practices such as continuous integration and continuous deployment (CI/CD).
Tasks :-
Start a new container and interact with it through the command line:
docker run -it ubuntu /bin/bashThis command starts a new container using the Ubuntu image and opens an interactive shell within it.
View detailed information about a container or image:
docker inspect [container_or_image_name_or_id]Replace
[container_or_image_name_or_id]with the name or ID of the container or image you want to inspect.List the port mappings for a container:
docker port [container_name_or_id]Replace
[container_name_or_id]with the name or ID of the container you want to list port mappings for.View resource usage statistics for one or more containers:
docker stats [container_name_or_id]Replace
[container_name_or_id]with the name or ID of the container you want to view statistics for. You can also specify multiple containers separated by spaces.View the processes running inside a container:
docker top [container_name_or_id]Replace
[container_name_or_id]with the name or ID of the container you want to view processes for.Save an image to a tar archive:
docker save -o [output_file_name.tar] [image_name]Replace
[output_file_name.tar]with the name you want to give to the tar archive file, and[image_name]with the name of the image you want to save.Load an image from a tar archive:
docker load -i [input_file_name.tar]Replace
[input_file_name.tar]with the name of the tar archive file containing the image you want to load.




