我需要使用docker-compose.yml将本地文件“Wiremock文件”复制到wiremock容器中。

我文件的路径是:

  • / src / test / resources / wiremock-docker / wiremock / __ files
  • / 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仅装载卷,而不将它们复制到镜像中

    关于docker - 使用docker-compose将Wiremock文件从本地复制到Docker容器,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47782578/

    10-10 20:14