DevOps, Day - 19

DevOps, Day - 19

Docker for DevOps Engineers, continued

  • Docker volumes are a way to store data generated by containers.

  • Volumes can be shared between containers and the host system.

  • Volumes are created and managed using the docker volume command.

  • Volumes allow you to persist data across container restarts or upgrades.

  • Volumes can be backed by different storage drivers, including local disk, network file systems, or cloud storage services.

  • A Docker network is a way to connect containers.

  • Networks are created using the docker network command.

  • Containers can communicate with each other by connecting to the same network.

  • Networks can be configured to restrict communication between containers or provide external connectivity.

  • Docker provides built-in network drivers for different use cases, such as bridge, host, overlay, and MACVLAN networks.

Task 1:

  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)

    step 1: clone the repo

    step 2: now use ls command to list

    step 3: now see the below steps and continue the process

    step 4: check the running containers using docker ps command, we will see '0' running containers as of now :(

    step 5: Use the docker-compose up command to start a multi-container application and docker-compose scale command to increase or decrease the number of replicas for a specific service.

    step 6: let's check in the browser :)

    step 7: Use the docker-compose ps command to view the status of all containers, and docker-compose logs to view the logs of a specific service.

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

Task 2:

  1. step 1: create a volume and use the docker volume inspect command as shown below

    step 2: mount the created volume to the container using docker run --mount command.

    step 3: Verify that the data is the same in all containers by using the docker exec command to run commands inside each container.

    created a new container

    Added new files in a new container(please see the container_ids)

    step 4: Use the docker volume ls command to list all volumes.

    step 5: use the docker volume rm command to remove volumes, let me show you 1 example :)

Thank you so much for reading.

Follow me on LinkedIn to see interesting posts like this : )

Linkedin

Β