简体   繁体   中英

How to access httpd.conf in Docker from a php image that included apache by itself?

Problem

I'm able to find the httpd.conf when I run a container from the httpd image, but I can't find that file when I run the container from a PHP image that includes apache, like the image php:7.4.2-apache-buster

The php image was ran this way, also $(pwd) is pointing to the proyect directory

docker container run -d -p 80:80 \
--name containerName \
-v $(pwd):/var/www/html \
php:7.4.2-apache-buster

Tried

I used docker container exec -it normalApache bash in the normal httpd image , in which I was able to find the httpd.conf file in /usr/local/apache2/conf

But when I try to do the exact same thing in the apache included with the php image, I can't find that file because the directory apache2 in /usr/local doesn't even exit

Whatever you are looking for, the Dockerfile for that container can be found at https://github.com/docker-library/php/blob/703a3d0a4e4c149bfd62fc3e7b71645f9496b178/7.4/buster/apache/Dockerfile , and in line 52 it uses /etc/apache2 as the configuration directory

51 ##<autogenerated>##
52 ENV APACHE_CONFDIR /etc/apache2
53 ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM