Hey, fellow DevOps enthusiasts! Today's #90daysofdevops task had me harnessing the power of Docker Compose. It's all about connecting the dots, or rather, containers. π³π‘
The Lowdown on Docker Compose π
Docker Compose is like the conductor of an orchestra, ensuring all containers work in harmony.
Compose Your Symphony: With a
docker-compose.yml
file, I defined my multi-container setup like crafting a musical score.The YAML Maestro: The
.yml
file format is the sheet music Docker Compose reads from β clean, structured, and intuitive.
What's YAML? π€
YAML (either "Yet Another Markup Language" or "YAML Ain't Markup Language") is the go-to for config files:
User-Friendly: It's easy on the eyes and simple to understand.
Versatile:
.yml
or.yaml
, it's all about structured data that's a breeze to read and write.
Task-1: Setting the Stage with docker-compose.yml
π
Dove into
docker-compose.yml
, where I specified my Django app services.Configured my web service, linked it to a database, and set environment variables without exposing them.
Here's a snippet:
With a single
docker-compose up
, my app danced to life.
Task-2: Running Containers Like a Pro πββοΈ
Pulled an image from Docker Hub and ran it locally, making sure to use a non-root user for security.
Played detective with
docker inspect
to understand my container's inner workings.Listened to the heartbeat of my container using
docker logs
.Practiced my container start/stop routine with
docker stop/start
.And finally, bid farewell to my container with
docker rm
.
Bonus: Dropping the sudo
π
Learnt that adding my user to the
docker
group lets me run Docker commands without thesudo
prefix. It felt like unlocking a new level in a game!sudo usermod -aG docker $USER
Just remember to reboot your machine after this change.
Wrapping Up Day 18 π
Today, Docker Compose lifted the veil on container orchestration, revealing a world where everything clicks into place with ease. The tasks today have me feeling like a DevOps maestro, confidently conducting my container ensemble. πΆπ³ #Day18 #DockerCompose #DevOpsEngineer #ContainerOrchestration #YAML #DjangoDockerized
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/