这不是错误,它只是一个警告,您可以放心地忽略它。它的意思是ServerName 未设置,因此它将假定机器IP 相同。
如果您查看/etc/apache2/sites-available 中的默认配置,您会发现000-default.conf 和default-ssl.conf
root@d591ab6febff:/etc/apache2/sites-available# cat 000-default.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
ServerName 指令在配置中被注释
#ServerName www.example.com
因此,如果您担心警告,您应该将其更改为您想要的值,如下所示
ServerName www.tarunlalwani.com
ServerAlias tarunlalwani.com
您需要在文件夹中创建一个配置,然后使用 Dockerfile 覆盖默认配置中的文件。然后警告就会消失。