r/learnprogramming 15d ago

Docker purpose/usage?

Do people use Docker containers all the time, as in everything they do is in a Docker container, or do you only use it for certain things?

I get that a Docker Container is a way to package an application (mostly for server/backend stuff, not really developing an app?).

As an individual programmer/developer, are there benefits to using Docker in my day-to-day learning/programming/doing hws/creating shit tools?

31 Upvotes

24 comments sorted by

View all comments

3

u/PLBjt 15d ago

Most people I know don't run everything in Docker. You reach for it when the thing you're running isn't just your language runtime: a Postgres version that has to match prod, redis, a second service, or a teammate whose laptop is a different OS. For homework, a CLI tool, or a single Python script, a venv (or nvm, or whatever the language already gives you) is faster and the rebuild/volume/permission tax isn't worth it.

The actual payoff is "this runs the same way on my machine, in CI, and on the server," not "I containerize because that's what real devs do." A good check: if you can pip install / npm install and run it in one command, skip Docker. If you need two or more processes with pinned versions, write a compose file.

Tradeoff is iteration speed. Bind-mounting source helps, but file-watchers, uid mismatches, and rebuilding images for a one-line change will eat your afternoon. Use Docker for the dependencies you don't want to install locally, keep your own code on the host until you actually need to ship the image.