DEV Community

Luis Felipe Ciochetta
Luis Felipe Ciochetta

Posted on

Learning Docker

Disclaimer

This is not a tutorial, I am just documenting what I have learned

I will have some links for tutorials at the end of the post if that's what you are here for


Hello folks

If there is one thing that makes me question my own knowledge about back-end and engineering in general is that I know close to nothing about docker

I have followed some tutorials in the past and got an app working with docker containers and I also studied it a little bit when I was studying CI/CD with Circle CI

But I really do not feel confident to write in resume that I know docker

So I will take some hours in the following weeks to fix this


Creating containers with simple Node apps

Following this tutorial I've created the most simple possible container with node, it's an app that runs on port 3333 and when it receives a get request, it returns "waddup"

So, the first cool thing I've learned is that I can create multiple instances of the same container assigning them to different ports:

Alt Text

I won't show each one, but believe me, they all answer "waddup" when I navigate to their ports (8001, 8002 and 8003)


Load balancing container

Alright, next thing, I've seen this tutorial (I really like this channel)

And have set up a load balancer that keeps calling my waddup apps

This one was a bit more challenging, mostly because I am a noob in writing Nginx config files than anything else


Docker compose

Ok, I have seen this video, from another great channel and started trying to use compose to create all my containers with a single command

However, I ended up watching another video from Hussein before actually doing it, in this video he is using HAProxy to do the load balancing, but I know even less about HAProxy than I know about Nginx, so I kept using it

And after some minutes fighting with the yml file, I've managed to, with a single command, create my 3 containers with a load balancer

hell yeah


Repository

Everything I did in this post can be found in this repository

GitHub logo ciochetta / learn-docker

repository for learning how to use docker


Conclusion

Loving to learn docker

Will probably try something more complex tomorrow, like creating a database and accessing it from various containers

I don't know, but I feel like I could do some very nice things with docker

Also, I know that there is a way to automatize docker containers creation with Kubernetes, I will probably also study this


Resources

This is what I have used to study for this post

https://docs.docker.com/docker-for-windows/install/

https://youtu.be/vmSMrQ8Ev9w

https://youtu.be/BRPvjNQsqis

https://youtu.be/gAkwW2tuIqE

https://youtu.be/9sAg7RooEDc

Top comments (0)