Hacker News new | ask | show | jobs
by c-hendricks 603 days ago
I love Docker (more so the idea of containers). Use it almost everywhere: self hosting services, at work everything is deployed as a docker container.

Except local development. Absolutely hate the "oh need to add a dependency, gotta rebuild everything" flow.

I do use it if the project I'm developing against needs a DB/redis/etc, but I don't think there's a chance I'm going back to using it for local development.

In fact, at work, the project where we do use docker in development actually causes the most headaches getting up and running.

I use a combination of CPU architectures, so the idea of running _exactly_ what's in production when developing is already out the window.

3 comments

I hate container and Docker in ANY use-case where there is an alternative that is same, or even "a little bit" more involved.

I reserve Docker and Containers for that use case where I really would have headaches if it is no there, and have not still found such a case in all the works I've done.

One thing Docker helps with is reproducibility. If you write your images properly (not many people do) then you can have exact same conditions for every time you run tests. If you keep databases on the host machine, instead of containers, you will have to have some cleanup steps and automate somehow, that they are always run. Otherwise you risk shaky test results or even false positives/negatives. That might be fine, if the CI runs the tests reliably as well though.
> same conditions for every time you run tests

I can understand it is something desirable sometimes... but most of the time that is exactly what I do not want of a test! I want to have everything changing, so I can test under other conditions. Running same test, for the same code, under the same conditions more than once, is redundant

Containers are great interface with other teams – ie black box their services, don't care how their things are running, just communicate which envs to use to make it work according to comms spec.
Everyone has different thresholds.
Docker for local development is only useful for running services like Postgresql and Redis, or doing hot reloads using something like vite or air. The development in a box paradigm is really difficult to maintain, much prefer direnv or nix.
Yup, at work we've been doing "dev machine bootstrap script installs version managers (nvm/mise/direnv/etc), projects use those" and have been experimenting with direnv + nix.
At least for python, I typically just add another RUN statement instead of changing a file used in a layer up the layer stack. That way the change is fast.

Then when I need to commit, I'll update the requirements file or whatever would cause all the layers to rebuild. And CI can rebuild the whole thing while I move to something else.

It is a bit of a pain, but the other benefits of containers are probably worth the trade off.