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

时间:2017-12-12 22:27:46

标签: docker docker-compose wiremock

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

我的文件路径是:

  1. / SRC /测试/资源/ wiremock-搬运工/ wiremock / __文件
  2. / SRC /测试/资源/ wiremock-搬运工/ wiremock /映射
  3. 我在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

    复制文件

1 个答案:

答案 0 :(得分:1)

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