简体   繁体   English

从Docker容器卷挂载(链接)单个文件

[英]Mount (link) a single file from a docker container volume

I created a docker volume called ssh that I mount to another container in ~/.ssh . 我创建了一个名为ssh的docker卷,该卷安装到~/.ssh另一个容器。 That's ok. 没关系。

I now want to create another volume which has files in ~/ , for example, .gitconfig 我现在要创建另一个在~/有文件的卷,例如.gitconfig

How could I mount (link) this file in my ~/.gitconfig with a container volume? 如何使用容器卷将这个文件安装(链接)到~/.gitconfig

I'm not aware of a way to mount a single file from a docker volume. 我不知道从Docker卷挂载单个文件的方法。

For a local volume you could mount the local files 对于本地卷,您可以挂载本地文件

$ docker run -v /var/lib/docker/volumes/home/_data/.gitconfig:/.gitconfig busybox ls -l /.gitconfig
-rw-r--r--    1 root     root             0 Jun  4 17:02 /.gitconfig

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

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