I have the following Dockerfile:
FROM php:8.0-apache WORKDIR /var/www/html EXPOSE 80 RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf && \ rm -rf /etc/apache2/sites-enabled/000-default.conf && \ service apache2 restart
I run the container on this image this way:
sudo docker run -d --name apache2-container -e TZ=UTC -p 8080:80 -v /home/xxx/www:/var/www/html -v /home/xxx/apache2.conf:/etc/apache2/apache2.conf my_image
/home/xxx/apache2.conf
is:
User ${APACHE_RUN_USER} Group ${APACHE_RUN_GROUP} ErrorLog ${APACHE_LOG_DIR}/error.log HostnameLookups Off # Include module configuration: IncludeOptional mods-enabled/*.load IncludeOptional mods-enabled/*.conf # Include list of ports to listen on Include ports.conf <Directory /> Options FollowSymLinks AllowOverride None Require all denied </Directory> <Directory /srv/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> ServerName localhost <VirtualHost *:80> DocumentRoot /var/www/html </VirtualHost>
There are no errors during image creation or container creation, but when I try to access localhost:8080
, the website loads for 15 minutes with no results.
What did i do wrong? Thanks
P粉9869374572024-02-04 10:28:59
I can't comment, but here are a couple of debugging questions: