DEV Community

Cover image for How do companies use Docker?🐋
gui martins
gui martins

Posted on

How do companies use Docker?🐋

Here i'll dispose how companies make use of containers, so you can understand the applicability of docker in real life!

First of all, when starting a new app, we encounter ourselves in the development phase, where developers make use of Docker to enhance their workflow.

Let's say, for instance, that we are creating an application in Ruby for Backend, and we need to test the Frontend in React that the other team is developing and at the same time we need a database that is managed by the DBAs. So, for we to have an development environment to test it all is a LOT of work, we are going to have to create a million of VMs, configure the database, inject schemas inside the database, configure React to connect to Ruby and Ruby to point to React. It's just so many things to make a developer pass through, even though our job is just code.

dev environment

And that's where docker shines, we have an isolated environment, our Backend, Frontend and database are all isolated. We can also create an isolated network to make things easier, mainly when we make use of docker-compose.

isolated dev environment

Docker-compose is an application inside docker that composes, so instead you build and run containers in an isolated way, we create a file and run docker-compose up and automatically we have our three containers perfectly working!

So imagine, the developer arrives at work at 9 A.M, sit down in his desk and run a docker compose up, everything is up in question of seconds without any configuration needed, he programs and at the end of the day he runs a docker-compose down and destroy the environment (that's fine because images never change) and the images that are in the storage of the machine are ready to be up again!!

And after that? how does the code arrives at the production phase? it's what we call continuous integration (CI). So the developer is working and has an stable code, he will commit and send the code to GIT, can be GitHub, GitLab, GitTea, BitBucket really any SCM available. After pushing to the repository, he will start a pipeline (our CI, which can be a Jenkins, GitLab, GitHub Actions or any other), where we'll have all our process automated.

continuous integration

Inside our CI, the first thing is usually tests, we'll have Unit test which are faster, after that we have docker inside this process, if the code is functional we want the code to run in production, so we make the build of the image (docker build), where we'll build the immutable image and push to the registry with docker push (a remote server that will store our images like ECR, Nexus, Jfrog...) and then make deploy (take our code and run for the client).

Afterwards we run it into the CI, it will run the tests, build the image with docker and push the image also with docker to the registry and then it starts the deploy.

Thenceforth, the last part where we'll also use docker, what we call continuous delivery (CD) which can run in Kubernetes, ECS, Docker Swarm or really anything that accepts a pattern of containers. We have a node (VM) that runs our orchestrator, inside the nodes we have containers (or pods) and when we make a deploy, it pulls the images from registry and transform it in a container inside Kubernetes.

kubernetes

Conclusion

I hope this serve as a quick and simple explanation on why Docker is so important for companies, it's an amazing tool that i'm planning to use more so I hope to bring a lot of interesting content soon!

Top comments (2)

Collapse
 
lukeecart profile image
Luke Cartwright

Thank you for sharing! Love the visuals

Collapse
 
perfectbleu profile image
gui martins

thank you!!