DEV Community

Cover image for ๐Ÿš€ Day 9 of My Cloud Journey: Mastering Docker Volumes, Compose & Registry
Avinash wagh
Avinash wagh

Posted on

๐Ÿš€ Day 9 of My Cloud Journey: Mastering Docker Volumes, Compose & Registry

When I started learning Docker, running containers felt exciting. But very quickly, I ran into a practical question:

๐Ÿ‘‰ What happens to my data when a container stops or gets deleted?

Thatโ€™s when I realized โ€” containers are ephemeral by design, and real-world applications need persistent storage, multi-service orchestration, and efficient image management.

So today, I explored three critical Docker concepts:
Volumes, Docker Compose, and Docker Registry ๐Ÿณ


๐Ÿงฉ Why This Matters

In modern cloud applications, we rarely run a single container. Instead, we deal with:

  • Databases that must retain data
  • Backend and frontend services running together
  • Applications deployed across environments

Handling all this manually is not scalable. Docker provides powerful solutions to simplify these challenges.


๐Ÿ“ฆ 1. Understanding Docker Volumes (Persistent Storage)

Containers are temporary, but data should not be.

Docker Volumes solve this problem by storing data outside the container lifecycle.

๐Ÿ”น What I Learned

  • Volumes persist data even if containers are removed
  • They are managed by Docker and are more reliable than container storage
  • Ideal for databases like MySQL, PostgreSQL, etc.

๐Ÿ”น Hands-on

docker volume create my-volume

docker run -d \
  --name mysql-db \
  -v my-volume:/var/lib/mysql \
  mysql
Enter fullscreen mode Exit fullscreen mode

โœ”๏ธ Even after removing the container, the data remains safe


โš™๏ธ 2. Docker Compose (Managing Multi-Container Apps)

Running multiple containers manually can quickly become messy.

Docker Compose allows us to define and manage multi-container applications using a single YAML file.

๐Ÿ”น What I Learned

  • Define services, networks, and volumes in one place
  • Start all services with a single command
  • Makes development and testing much easier

๐Ÿ”น Sample docker-compose.yml

version: '3'
services:
  db:
    image: mysql
    container_name: mysql-db
    environment:
      MYSQL_ROOT_PASSWORD: root
    volumes:
      - db-data:/var/lib/mysql

  app:
    image: flask-app
    container_name: flask-app
    ports:
      - "5000:5000"
    depends_on:
      - db

volumes:
  db-data:
Enter fullscreen mode Exit fullscreen mode

โ–ถ๏ธ Run everything

docker compose up -d
Enter fullscreen mode Exit fullscreen mode

โœ”๏ธ Multiple services running together with one command


๐ŸŒ 3. Docker Registry (Image Management)

Once applications are built, they need to be shared and deployed.

Docker Registry helps store and distribute images across environments.

๐Ÿ”น What I Learned

  • Images can be pushed to repositories like Docker Hub
  • Enables easy deployment across teams and servers
  • Versioning helps manage application updates

๐Ÿ”น Basic Workflow

docker tag my-app username/my-app
docker push username/my-app
docker pull username/my-app
Enter fullscreen mode Exit fullscreen mode

โœ”๏ธ Simplifies deployment and collaboration


๐Ÿ’ก Key Takeaways

  • Volumes ensure data persistence
  • Docker Compose simplifies multi-container orchestration
  • Registry enables image sharing and deployment
  • These concepts are essential for real-world DevOps and cloud environments

๐Ÿ”„ My Learning Reflection

Todayโ€™s learning shifted my mindset from:
๐Ÿ‘‰ โ€œRunning containersโ€
to
๐Ÿ‘‰ โ€œDesigning real-world, scalable applications using Dockerโ€

Iโ€™m starting to see how these concepts connect to tools like Kubernetes and cloud platforms like AWS.


๐Ÿ“˜ Learning in Public

Iโ€™m documenting my journey as I transition from .NET Developer to Cloud Engineer.


๐Ÿ’ฌ Letโ€™s Connect

If you're learning Docker, DevOps, or Cloud โ€” Iโ€™d love to connect, learn, and grow together.

Feedback and suggestions are always welcome ๐Ÿ™Œ

Top comments (0)