[英]How do I share a docker-compose volume with a linux host?
I have a docker-compose.yml我有一个 docker-compose.yml
version: '3.3'
services:
ssh:
environment:
- TZ=Etc/UTC
- DEBIAN_FRONTEND=noninterative
build:
context: './'
dockerfile: Dockerfile
ports:
- '172.17.0.2:22:22'
- '443:443'
- '8025:8025'
volumes:
- srv:/srv:rw
restart: always
volumes:
srv:
After I run docker-compose up --build I can ssh to the docker vm and there are files in /srv.在我运行 docker-compose up --build 我可以 ssh 到 docker 虚拟机并且 /srv 中有文件。 'docker volume ls' shows 2 volumes, srv and dockersetupsrv.
'docker volume ls' 显示 2 个卷,srv 和 dockersetupsrv。 They are both in /var/lib/docker/volumes.
它们都在 /var/lib/docker/volumes 中。 They both contain _data directories and show creation time stamps that match the docker image creation times but are otherwise empty.
它们都包含 _data 目录并显示与 docker 图像创建时间相匹配的创建时间戳,否则为空。 Neither one contains any of the files that are in the docker container's /srv directory.
两者都不包含 docker 容器的 /srv 目录中的任何文件。 How can I share the docker /srv directory with the host?
如何与主机共享 docker /srv 目录?
you should point out more specific for the mapping directory, for example:你应该指出更具体的映射目录,例如:
you can have a check in this link: https://docs.docker.com/storage/volumes/您可以查看此链接: https://docs.docker.com/storage/volumes/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.