Hacker News new | ask | show | jobs
by diggan 821 days ago
> What's the point of using Docker for PHP apps?

Same reason you'd use Docker for anything, why would it matter if it's Python, PHP or Rust?

Is there something specific about the language that makes Python (or other language) more suitable with Docker for you, compared to PHP?

(Personally I only use Docker when I start to deal with multiple hosts/distributed architecture, which doesn't happen a lot tbh)

2 comments

> Is there something specific about the language that makes Python (or other language) more suitable with Docker for you, compared to PHP?

Python has notoriously awful dependency management. One of the biggest appeals of Docker is that it lets you build the equivalent of a "fat jar" so that you get at least somewhat reproducible versions of your dependencies at runtime. For a language with decent dependency management the value proposition is much weaker.

I can't think of anything that Docker would give Python that pyenv and venv wouldn't already.

Not that I wouldn't just use Docker for this, but those two help a lot when dealing with multiple clients who have different versions requirements.

I can give you one example from recent memory: packaging tkinter dev packages with your tkinter python app. Tkinter usually requires some system dependencies on top of python dependencies.
> Same reason you'd use Docker for anything, why would it matter if it's Python, PHP or Rust?

I would ask the same question if you were using docker for a Rust project btw.

IMHO Docker mostly make sense when you have projects that require globally installed dependencies (like C or Python).

A globally installed dependency such as, say, PHP?
PHP is somewhat different, because there are many providers that can host it for you in a “serverless” fashion, and the deployment process is as easy as it can ever be: just drop the files on the server and call it a day.

As such it makes little sense to deploy a PHP app on a dedicated server where you're responsible for the PHP server. Or when it is, it's because that you have many of such apps, but then deploying them all side by side with their own Apache/Nginx is going to be very wasteful.