OpenSSL not working correctly in Alpine based PHP docker images
Mainly because of the significantly smaller size I'm currently switching to Alpine-Linux based docker images. In connection with PHP images (PHP-FPM as well as CLI) I stepped onto an issue with the OpenSSL extension for PHP which seemed not to work correctly. In my case I noticed this in a TYPO3 setup because TYPO3 tests the OpenSSL extension in the install tool.
The reason for the extension not working in the Alpine based images is a missing default value for the private key length. In /etc/ssl/openssl.cnf the line #default_bits = 2048 is commented out. This could though easily be solved with the following command in the Dockerfile:
RUN sed -i 's/#default_bits/default_bits/' /etc/ssl/openssl.cnf