【问题标题】:How should I mount a host httpd.conf file into an Apache httpd Docker container?我应该如何将主机 httpd.conf 文件挂载到 Apache httpd Docker 容器中?
【发布时间】:2023-02-07 06:20:01
【问题描述】:

我正在使用以下方法启动一个 docker 容器:

docker run -d \
    --add-host=host.docker.internal:host-gateway \
    --name=apache \
    --restart always \
    -e PUID=1000 \
    -e PGID=1000 \
    -e TZ=Europe/London \
    -p 80:80 \
    -v /share/CACHEDEV1_DATA/Container/apache/config/httpd.conf:/usr/local/apache2/conf/httpd.conf \
    -v /share/CACHEDEV1_DATA/Container/apache/config/httpd-vhosts.conf:/usr/local/apache2/conf/extra/httpd-vhosts.conf \
    httpd:latest

不幸的是,容器中的 httpd.conf 文件确实不是匹配主机中的本地文件。有趣的是,容器中的httpd-vhosts.conf 文件与主机中的本地文件匹配。

【问题讨论】:

  • docker run 命令似乎没问题,并且与 httpd image documentation 匹配。当您说“它不匹配”时,您实际看到的是什么?你是直接在原生 Linux 系统上使用 Docker 引擎,还是其他?
  • 我看到了“原始”httpd.conf 文件,即 httpd:latest 版本默认附​​带的文件。

标签: docker apache httpd.conf


【解决方案1】:

根据 here 的描述,基于 httpd:latest 构建您自己的图像

FROM httpd:latest
COPY ./my-httpd.conf /usr/local/apache2/conf/httpd.conf

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-01-01
    • 1970-01-01
    • 2021-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多