🐳 My Docker Journey: From Zero to "It Works on My Machine" (For Real This Time 😂!)
The Starting Point
The First “Aha!” Moment
Real Challenges I Tacked
My Biggest Wins
Some Tips
Next Steps
To Anyone Starting Out
The Starting Point
Like many, I started my DevOps bootcamp thinking "What's the deal with containers?”
As I continue my journey to become a DevOps Engineer, this is the fourth article about the DevOps Bootcamp by Roxs I'm completing.
Docker is a tool that packages applications with all their dependencies, ensuring they run consistently anywhere. Imagine it as creating small, portable environments (containers) that keep everything an app needs in one place, eliminating the "it works on my machine" problems 😅!
I was excited to learn about Docker because it seemed like the key to solving environment issues. Running apps in isolated containers felt powerful. However, I was also intimidated because Docker has its own terminology and commands. The combination of new concepts and tools made it feel like a steep learning curve, but the benefits were too appealing to ignore.
The First "Aha!" Moment
While studying the Docker section in the bootcamp, I went through the architecture, learned how to create images, publish those images, run containers from those images, and use Docker Compose.
But the first "Aha!" Moment came when I started working on the exercises and challenges from the Bootcamp, gaining hands-on experience.
Alright, let me share what I've been up to in my Docker journey! 🐳
First up was getting my hands dirty with MySQL containers. Not gonna lie, managing databases used to give me anxiety, but Docker made it feel like putting together LEGO blocks.
The real game-changer? Running MySQL with PHPMyAdmin containers together. Seeing these two containers talk to each other was like magic ✨ (okay, maybe not magic, but definitely felt like it at first!).
Then came the fun part: deploying my first PHP web app in a container. Sure, I ran into some obstacles, but that feeling when your application finally spins up in a container? Priceless! 🤩
The PostgreSQL + pgAdmin setup with Docker Compose was next on my list. Let me tell you - Docker Compose is a lifesaver! Instead of typing multiple commands, it was just one docker compose up
and boom! 💥 Both services running together.
Finally, I set up a complete PHP development environment 🙌.
I would like to share the container analogy that made sense in my head 🐳:
🚀🧑🚀The Spaceship Analogy, I started thinking about containers like tiny spaceships. Each one needs to be completely self-sufficient, its own environment, resources, and life support systems (dependencies). They can dock with the mothership (host system) but remain independent. Just like a spaceship needs to work the same whether it's docked at Earth or Mars, a Docker container runs the same whether it's on my laptop or in the cloud.
Real Challenges I Tackled
Let me tell you about the juicy part of my Docker journey, the actual problems I had to solve:
First up was getting MongoDB and Mongo Express containers to play nice together. Simple enough on paper, right? Well, I learned about container networking and environment variables. But when I finally saw Mongo Express pop up in my browser, connecting smoothly to MongoDB? Was great! 🙌
The "295topics" project involved getting Node.js, Nginx, and MySQL to work together. Each time a page refreshed, it needed to add a record to MySQL and display it back. It sounds simple, but it's a different story when you're actually doing it!
While the Docker basics like managing containers and images were not that hard to handle, the real test came when I had to take on the “Full Stack Challenge with Java, Go, and PostgreSQL” challenge. Tackling this felt like I was brewing up something crazy in the lab: managing Java, Go, and PostgreSQL all in one project.
At first, I was a little intimidated..I mean, Java and Go were completely new to me.
The goal was to automate the entire build, test, package, and deployment process using Docker and Docker Compose.
Now, the tricky part was getting these three components: the Java API (backend), the Go web app (frontend), and the PostgreSQL database, to play nice together. I had to make sure they could talk to each other seamlessly, without any problems.
Just when I thought I had it all figured out, I ran into an issue with the source code.
So I dug into the code, and started troubleshooting.
After a few cups of coffee and some intense debugging sessions, I finally managed to solve it!. But I wasn't done yet, I still had to incorporate semantic versioning and set up a bash script to automate the deployment process.
Writing that deployment script felt like putting together a puzzle 🧩. The script automates the process of building docker images, tag the with versions using a git describe, push them to Docker Hub and running docker-compose.yaml
file. ✅
The best part? Documenting everything on my Github Repo. Not just "it works now," but the actual journey: the obstacles I faced, the solutions I found, and (most importantly) why they worked. Because let's be real, future me is going to thank past me for those notes! 📝
Looking back, these weren't just tasks to check off a list. Each challenge taught me something valuable about how containers work in the real world. And that feeling when all services are running smoothly, and your Docker Compose up command works? Worth every debugging session! 🚀
My Biggest Wins
Seeing my containers finally talk to each other through the custom network, and watching my API successfully store data in the MongoDB container, it was amazing 🤩.
Before Docker, setting up my development environment was like building a house of cards. One wrong version of Node and everything would collapse. Then came the bootcamp's Docker module. The first time I wrote a proper Dockerfile, created a .dockerignore
, and saw my application running in an isolated container, it clicked🚀.
It happened during our micro-services project. I was staring at my docker-compose.yml
file, with multiple services, volumes, and networks defined, when suddenly it all made sense. Containers weren't just isolated boxes anymore, they were building blocks. Each container had its purpose: the frontend, the backend API and the database.
The moment I realized I could bring down my entire development environment with docker compose down
and rebuild it exactly the same way with docker compose up build
was when I truly understood the power of containerization. The best part? I could confidently say "it will work on your machine too" and mean it.
Some Tips
Run
docker system prune
regularly to avoid filling your disk with unused images and containers.Name your containers meaningfully with
container_name
indocker-compose.yaml
, it makes logs much easier to follow.docker logs -f container_name
is your best friend for real-time debugging, ALWAY check the logs!Use
docker exec -it container_name sh
to get inside a container and poke around.Always check container health with
docker ps
, the 'Up' time can tell you if containers are crash-looping.Use
depends_on
indocker-compose.yaml
to handle service startup order.
And finally the resources that actually helped me was the Docker section in the DevOps Bootcamp by Roxs.
Next Steps
Getting comfortable with Docker has opened up a whole new world of possibilities. What I've learned about containers isn't just for development anymore, it's about building scalable, production-ready applications. The skills I've gained in Docker and container orchestration are setting the perfect foundation for my Kubernetes ⚙️ journey. I can already imagine deploying my applications, setting up automatic scaling, and managing everything through Kubernetes. It's like I've learned to ride a bike 🚲 with Docker, and now I'm ready to hop on a motorcycle 🏍️ with Kubernetes⚙️! I've already started experimenting with minikube on my local machine 🙌👩🏽💻.
To Anyone Starting Out
Here's the truth: everyone struggles at first. That moment when you're staring at terminal errors, wondering why your container won't start, or why your services can't seem to talk to each other, we've all been there. But here's the thing: that confusion is temporary, and the clarity that follows is absolutely worth it.
Practical First Steps:
Start small: Like, really small: Get a single container running first. I started with a simple hello world app.
Master the basic commands:
docker build
,docker run
,docker ps
Don't jump into docker-compose until you understand single containers
As you progress, you might feel like you're hitting a wall or getting stuck with errors. This is when having a mentor can really help. I can't highlight enough how valuable it is to have someone experienced to guide you through these tough times. For me, that mentor has been Mariano González. His support after I spent hours debugging was invaluable. Sometimes, all it takes is a fresh perspective or an explanation of concepts that you're struggling to understand.
Mentorship isn’t just about getting answers, it's about learning how to approach problems more effectively and building confidence. Mariano González’s insights and patience helped me break through some of my toughest obstacles, and having someone who genuinely cares about helping others can turn an overwhelming learning process into an enjoyable experience.
So, if you can, find a mentor. They can help you avoid common pitfalls and offer advice. Don’t be afraid to ask questions or ask for help. It's all part of the learning process.
That's it for today! I'll see you in the next post, which will be all about Kubernetes ⚙️
Subscribe to my newsletter
Read articles from Laura Diaz directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Laura Diaz
Laura Diaz
Hello there, I'm Laura, a Frontend Developer ready to explore the world of cloud technologies ☁️. I'm eager to share my experiences, challenges, and triumphs as I explore the possibilities that the cloud offers. Let's embark on this expedition together!