Docker Compose-命名卷不更新内容

时间:2020-01-30 17:35:16

标签: docker docker-compose

我正在使用此docker-compose来提供来自nginx的静态内容。

我正在尝试覆盖/usr/share/nginx/html上的nginx index.html。

要实现我正在使用命名卷,请在服务content中在文件夹/build中生成此静态内容,并将其传递到我们的命名卷static-content

在服务reverse-proxy中,我使用相同的命名卷static-content并指向/usr/share/nginx/html,以便覆盖index.html。

我已经确认/build文件夹中包含文件,但是由于某种原因什么也没发生,因此创建了命名卷,但是nginx文件夹仍然包含默认的index.html,并且没有其他静态文件在/build内部。 你能帮我吗?

  content:
      image: "${DOCKER_REGISTRY}/content"
      volumes:
        - static-content:/build
      build:
        context: .
      depends_on:
          - reverse-proxy

  nginx:
      image: "${DOCKER_REGISTRY}/nginx"
      build:
        context: .
      volumes:
        - static-content:/usr/share/nginx/html
      ports:
        - target: 80
          published: 80
          protocol: tcp
          mode: host
        - target: 443
          protocol: tcp
          mode: host

volumes:
    static-content:

0 个答案:

没有答案