使用 docker-compose 将 wiremock 文件从我的本地复制到 Docker 容器

Copying wiremock files from my local to Docker container using docker-compose

我需要使用 docker-compose.yml.

将我的本地文件 "Wiremock files" 复制到 wiremock 容器中

我的文件路径是:

  1. /src/test/resources/wiremock-docker/wiremock/__files
  2. /src/test/resources/wiremock-docker/wiremock/mapping

我在 docker-compose

中生成下一个 Wiremock 图像
wiremock:
image: '${WIREMOCK_IMAGE}'
volumes:
- ./src/test/resources/wiremock-docker/wiremock/__files/:/home/wiremock/__files
- ./src/test/resources/wiremock-docker/wiremock/mappings:/home/wiremock/mappings

exposedPorts: [8080/tcp] attachStdin: true attachSterr: true dnsSearch: [losthost] alwaysPull: false portBindings: [8585->8080/tcp]

我尝试使用卷,但是文件夹“__files”和 "mapping" 中的文件没有复制到图像中

数量:

- ./src/test/resources/wiremock-docker/wiremock/__files/:/home/wiremock/__files
- ./src/test/resources/wiremock-docker/wiremock/mappings:/home/wiremock/mappings**

我知道使用 Dockerfile 有效:

FROM rodolpheche/wiremock

EXPOSE 8585 8080 8081

COPY wiremock /home/wiremock

但在这种情况下,我需要从 docker-compose

复制文件

docker-compose 只挂载卷而不是将它们复制到镜像中