DEV Community 👩‍💻👨‍💻

Daniel da Rocha
Daniel da Rocha

Posted on

Explain Docker Like I'm Five

What is it actually and why/when/where should I/could I use it?

Top comments (5)

Collapse
quii profile image
Chris James • Edited on

Once upon a time before Docker if you wanted to have a unified dev environment where a new hire wants to start working if they're lucky there is a vagrant setup which sucks up 80% of your system's resources or more typically some out of date documentation like "download this thing, extract it here, add these env vars" and then it still doesnt work.

In the world of docker you can very easily configure all the system dependencies you need for your project in a consistent, easy way with a few config files.

Not only that but if you work with docker locally and in production you can say "it works on my computer" and with some legitemacy expect it to work in production too.

Docker is not without problems but a lot of my dev life has been wasted reconfiguring snowflake db setups because they got out of date in CI vs live or vs dev.

Docker brings a unified way of setting up your work in a production-like environment

Collapse
danroc profile image
Daniel da Rocha Author

Got it!

Could I make a parallel to Python virtual environments, with a requirements.txt file? I understand that Docker is more encompassing, while Python virtualenvs are Python-only, but it is the same base idea, right?

D.

Collapse
quii profile image
Chris James

I haven't done much Python but from what i understand that means when you cd into the directory it sets up the env vars for you?

If yeah, kinda?

As always, the best thing to do is try it yourself.

Get docker installed and then set up a docker-compose file with a DB configured in it. Do docker-compose up, smile. Then add another db to the file and then pick your jaw up from the floor when you realise how easy it all is.

Collapse
srleyva profile image
Stephen Leyva (He/Him) • Edited on

There are some parallels in concept maybe? The key difference is while Python Virtual Environments isolate which Python interpreter, environment, and paths you use, its still apart of the host system.

Docker images are only reliant upon the host kernel and run isolated from the system like a sandbox.

Example: Wanna test what a particular command or python script will do to a system without affecting the actual host? Run it inside a docker container.

Collapse
rhymes profile image
rhymes

I think this will help. They explain containers and Docker

dev.to/mmg/explain-containers-like...

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.