Docker for DevOps Engineers: Part-3

Docker for DevOps Engineers: Part-3

Docker-Volume:

A Docker volume is a way to store data outside of a Docker container's filesystem. This allows data to persist even if the container is deleted or recreated. Volumes can also be shared among multiple containers and can be backed by various storage drivers, such as local files or network storage. This allows for greater flexibility and control over data storage in a Docker environment.

Docker Network:

Docker network is a feature in Docker that allows containers to communicate with each other and with the host system. It provides a way to create and manage virtual networks for container communication. There are several types of networks that can be created in Docker, including bridge, host, and overlay networks. Each type of network provides different capabilities and can be used for different use cases. For example, a bridge network allows containers on the same host to communicate with each other, while an overlay network allows containers on different hosts to communicate. Additionally, Docker networks can be used to configure network settings such as IP addresses, ports, and DNS.

Task-1:

Create a multi-container docker-compose file which will bring?UP?and bring?DOWN?containers in a single shot (Example - Create application and database container)

  • The docker-compose up command with the -d flag is used to start and run a multi-container application defined in a docker-compose.yml file in detached mode. The -d flag stands for "detached" mode and it runs the container in the background.

No alt text provided for this image

  • The docker-compose scale command is used to adjust the number of containers for a service defined in a docker-compose.yml file. This command allows you to easily scale the number of containers running for a particular service, which can be useful for handling changes in traffic or load.

No alt text provided for this image

  • The docker-compose ps command is used to list the containers that are running for a multi-container application defined in a docker-compose.yml file. This command will display the status of each container, including the container name, service name, and the command that was used to start the container.

No alt text provided for this image

  • The docker-compose logs command is used to view the logs for all the services defined in a docker-compose.yml file. This command will display the logs for all the running containers for the specified services, in real-time.

No alt text provided for this image

  • The docker-compose down command is used to stop and remove all the containers, networks, and volumes defined in a docker-compose.yml file. This command will stop and remove all the containers that were created by the docker-compose up command, as well as any networks and volumes that were created for the application.

No alt text provided for this image

Task-2:

  • Learn how to use Docker Volumes and Named Volumes to share files and directories between multiple containers.
  • Create two or more containers that read and write data to the same volume using the?docker run --mount?command.
  • Verify that the data is the same in all containers by using the docker exec command to run commands inside each container.
  • Use the docker volume ls command to list all volumes and docker volume rm command to remove the volume when you're done.

No alt text provided for this image

Thank you for reading! I hope you find this article helpful.

Happy Learning ??

要查看或添加评论,请登录

Nihal Apretwar的更多文章

  • SQS (Simple Queue Service):

    SQS (Simple Queue Service):

    What is SQS: Amazon Simple Queue Service (SQS) is a managed message queuing service technical professionals and…

  • Amazon S3: (Simple Storage service):

    Amazon S3: (Simple Storage service):

    What is S3: It provides object storage which is build for storing and recovering any amount of data from anywhere over…

  • Elastic Compute Cloud (EC2)

    Elastic Compute Cloud (EC2)

    What is EC2 : Amazon EC2 Provides secure and resizable compute capacity in the AWS cloud. You can use Amazon EC2 to…

  • IAM (Identity and Access Management)

    IAM (Identity and Access Management)

    IAM : AWS identity access management is a web service that help you securely control access to AWS resources. You use…

  • AWS (Amazon Web Services)

    AWS (Amazon Web Services)

    What is AWS ? AWS stands for Amazon web services. AWS is a secure cloud service platform that provides on-demand…

    1 条评论
  • Jenkins Declarative Pipeline:

    Jenkins Declarative Pipeline:

    One of the most important parts of your DevOps and CICD journey is a Declarative Pipeline Syntax of Jenkins. Some…

  • Complete Jenkins CI/CD Project - Continued with Documentation

    Complete Jenkins CI/CD Project - Continued with Documentation

    I can imagine catching up will be tough so take a small breather today and complete the Jenkins CI/CD project from Day…

    6 条评论
  • Complete Jenkins CI/CD Project:

    Complete Jenkins CI/CD Project:

    Let's make a beautiful CI/CD Pipeline for your Node JS Application ?? Task-01: Fork this repository: Create a…

    1 条评论
  • Jenkins Freestyle Project for DevOps Engineers:

    Jenkins Freestyle Project for DevOps Engineers:

    What is CI/CD? CI or Continuous Integration is the practice of automating the integration of code changes from multiple…

  • Getting Started with Jenkins:

    Getting Started with Jenkins:

    What is Jenkins? Jenkins is an open source continuous integration-continuous delivery and deployment (CI/CD) automation…

    2 条评论

社区洞察

其他会员也浏览了