Day 19 Task: Docker for DevOps Engineers

Docker-Volume:-

Docker volumes are file systems mounted on Docker containers to preserve data generated by the running container. The data doesn't persist when that container no longer exists, and it can be difficult to get the data out of the container if another process needs it.

Docker Network:-

What is the Docker network?

Image result for docker network

Docker networking enables a user to link a Docker container to as many networks as he/she requires. Docker Networks are used to provide complete isolation for Docker containers. Note: A user can add containers to more than one network. Let's move forward and look at the Advantages of networking.

Task-1

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

  • Use the docker-compose up command with the -d flag to start a multi-container application in detached mode.

  • Use the docker-compose scale command to increase or decrease the number of replicas for a specific service. You can also add replicas in deployment file for auto-scaling.

  • Use the docker-compose ps command to view the status of all containers

  • Use the docker-compose logs to view the logs of a specific service.

  • Use the docker-compose down command to stop and remove all containers, networks, and volumes associated with the application

  • 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

    Use the docker volume rm command to remove the volume when you're done

    • Hope you like this blog. Please follow for more blogs like this.....

      Thank you.