Okay. I swore about crap all the day long, trying to get CGI's to write to a database using the default httpd:2.4 docker image.
NOTHING worked.
Until I found some obscure post referencing extending an image, I was at a loss. Then, with the reference to "extending an image", I knew what to search for, and finally got it. Here's what to do. You can "create" a new image using a "build", e.g. create a Dockerfile containing :
# Sample Dockerfile for extending a container
FROM httpd:latest
RUN apt-get update && apt-get install -y libdbd-mysql-perl
CMD ["httpd-foreground"]The file says to take the httpd:latest, run a command on it, then set the command to run (could already be there, I don't know - it just worked and make me very happy).
Then, run :
docker build -t httpd:mysql .After that, change your docker-compose.yml to reference your new image, and then you should be able to make it function. Granted, CGI's need the REMOTE_USER if you are doing anything specific with that, so add the config where you need it to pull the authenticated user from the Cloudflare header containing the username and stuff it.
# set the REMOTE_USER variable
RewriteCond %{HTTP:Cf-Access-Authenticated-User-Email} ^(.*)$
RewriteRule .* - [E=REMOTE_USER:%1]Then stop the container and start it back up, and that part should be functional. The bonus is you can extend all you want.


No comments:
Post a Comment