dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
6.84k stars 233 forks source link

Docs: Why is Debian Recommended for Docker? #940

Open MarkusJLechner opened 3 months ago

MarkusJLechner commented 3 months ago

https://frankenphp.dev/docs/docker/

FrankenPHP Docker images are based on official PHP images. Debian and Alpine Linux variants are provided for popular architectures. Debian variants are recommended.

The headline states that Debian is recommended. Documentation should provide clarification rather than just statements; therefore, an explanation or reference supporting this recommendation should be included.

nickchomey commented 3 months ago

That is a bit strange - as far as I'm aware, alpine is by far the most common in docker images. It would indeed be useful to know why debian is recommended instead.

withinboredom commented 3 months ago

My 2¢ and why I don't recommend musl/alpine in production:

Multiple reasons, mostly due to musl implementation details breaking something in Go/PHP. Also, fwiw, the 'official php' images are managed by the community and aren't maintained by php, nor does PHP have any unit tests running on alpine (https://github.com/php/php-src/actions/runs/10094146717 for example).

Secondly, if you search the PHP issues, musl bugs are fixed rather quickly, but only once they are reported. There isn't any proactive hunting for those bugs.

And finally, many libraries (like openssl, for example) have to disable a bunch of failing tests for musl.

OH, and I almost forgot to mention the DNS shenanigans that happen on alpine php... if you haven't run into the "internet disappearing bug" yet, it's super confusing and was the straw that broke our back at work; when we moved to debian-only.

Personally, I wouldn't recommend it for production systems, just to shave a few dozen megabytes off an image size. If you absolutely need those megabytes, then go for it.

withinboredom commented 3 months ago

It's also worth noting that this probably won't always be the case. Rereading that it sounds like doom-and-gloom, but it isn't that bad. It works most of the time, but when it doesn't work, it can be very frustrating.

sneycampos commented 3 months ago

https://github.com/dunglas/frankenphp/issues/940

https://x.com/dunglas/status/1765738034782142699

MarkusJLechner commented 3 months ago

Thanks @sneycampos for the link. For those who don't have access to X, I'll post the comments here:

The mentioned issue https://github.com/dunglas/symfony-docker/issues/555 mostly explains why the documentation recommends Debian. The performance issue discussed on Stack Overflow may also be relevant to some users. @withinboredom's comment is also valuable.

Updating the docs or mentioning this issue could help others who encounter the same question why Debian is preferred. Since it's clear to me, I wouldn't mind closing this issue.

dunglas commented 3 months ago

A docs PR would be very welcome!