Day 19 Task: Mastering Docker Compose and Volumes ๐Ÿณ๐Ÿ’พ

Day 19 Task: Mastering Docker Compose and Volumes ๐Ÿณ๐Ÿ’พ

ยท

3 min read

Hey cloud adventurers! On Day 19 of our DevOps journey, we're diving deeper into Docker's sea of features. Today, we're all about volumes and networks, the unsung heroes of persistent data and container communication. ๐ŸŒ๐Ÿ—‚๏ธ

Docking into Docker Volumes ๐Ÿ“ฆ

Volumes are the storage wizards in Docker. They safeguard our data like treasure chests, ensuring that our precious databases and files are not lost when containers walk the plank.

  • Creating Persistent Treasures: I used volumes to persist data generated by and used by Docker containers. Like creating a chest that stays afloat even when the ship sinks.

Networking the Container Fleet ๐Ÿšข

Docker networks are the high seas that connect our container ships, allowing them to communicate and navigate the vast data ocean.

  • Building the Container Armada: I spun up a network that allowed containers to talk to each other, creating a mighty fleet of services that work together seamlessly.

Task-1: Composing a Docker Symphony ๐ŸŽผ

Today's composition involved orchestrating multiple containers with a docker-compose.yml.

  • ๐Ÿ“ Composing the Score: Defined my app and database services in the docker-compose.yml.

  • ๐Ÿš€ Launching the Fleet: With docker-compose up -d, I launched my services into the background.

  • ๐Ÿ“ˆ Scaling the Crew: Adjusted the number of container crewmates with docker-compose scale.

  • ๐Ÿ“Š Monitoring the Deck: Kept an eye on the containers with docker-compose ps and checked their logs when needed.

๐Ÿ‘‡ Anchoring Down: When the voyage was complete, I used docker-compose down to gracefully stop and remove my containers, along with their networks and volumes.

Task-2: Shared Storage Sorcery with Docker Volumes ๐Ÿง™โ€โ™‚๏ธ

  • Volume Creation: Crafted a named volume to share data among multiple containers.

  • Conjuring Containers: Summoned containers using docker run --mount to read and write to the shared volume.

  • Peek Inside the Magic: Used docker exec to check that each container could access the shared data.

  • Volume Listing: Listed all volumes with docker volume ls to see my created volumes.

  • Cleanup Spell: When the testing was done, docker volume rm helped me clean up unused volumes.

Reflecting on Today's Learning ๐ŸŒŸ

Today was all about ensuring our data's immortality with Docker volumes and crafting a network for our containers to thrive in. These tools are crucial for maintaining data beyond the container's lifecycle and for service interaction within our applications. ๐Ÿ“š #Day19 #DockerCompose #DevOpsEngineer #PersistentData #ContainerNetworking

Thank you for reading this Blog. Hope you learned something new today! If you found this blog helpful, please like, share, and follow me for more blog posts like this in the future.

You can connect with me at: https://www.linkedin.com/in/davendersingh/

ย