I have 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
And I am running container on that images in 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 aren't any errors during creating image or creating container, but when I try to visit localhost:8080
, site is loading for 15 minutes without any result.
What am I doing wrong? Thanks
I cannot comment, but here is a couple of debugging questions:
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.