简体   繁体   English

如何通过在 docker-compose.yml 文件中定义卷来访问 docker 容器内生成的文件

[英]How to access the file generated inside docker container by defining the volume in docker-compose.yml file

I am rookie when it comes to docker container , can somebody help me here.我是 docker 容器的新手,有人可以在这里帮助我吗?

There is a project which generates a output files when running inside docker container , I need to add Volume inside docker-compose.yml file, So that the output files are accessible outside the container .有一个项目在 docker 容器内运行时会生成输出文件,我需要在 docker-compose.yml 文件中添加Volume ,以便在容器外可以访问输出文件。

Please do provide me indetail knowledge of how can I do this?请向我提供有关如何执行此操作的详细知识?

Define volumes in the docker-compose.yml file, mapping source on the server to target in the container:docker-compose.yml文件中定义卷,将服务器上的源映射到容器中的目标:

volumes:
  - "./relative/path/on/host:/absolute/path/in/container:rw"

Reference:参考:

https://docs.docker.com/storage/volumes/#use-a-volume-with-docker-compose https://docs.docker.com/storage/volumes/#use-a-volume-with-docker-compose

There hopefully should be a readme.md file in the project which lists the options on how to get the output (files).希望项目中应该有一个readme.md文件,其中列出了有关如何获取输出(文件)的选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM