简体   繁体   English

挂载数据量,然后在Docker中创建容器时创建符号链接

[英]Mount data volume, then create symbolic link at container creation in docker

When docker-compose creates the container, is it possible to create a symbolic link from volume-mounted directory to another location in container? 当docker-compose创建容器时,是否可以创建从卷挂载目录到容器中其他位置的符号链接?

I know it can be done in the Dockerfile, but I wont have the data volume mounted at the moment of building the image. 我知道它可以在Dockerfile中完成,但是在构建映像时我不会挂载数据量。

You can create a symbolic link to a file or directory that doesn't exist. 您可以创建一个指向不存在的文件或目录的符号链接。 And you can also mount a volume over top of an existing file/directory and the symbolic link will point to the newly mounted contents. 您还可以在现有文件/目录的顶部安装卷,符号链接将指向新安装的内容。 So add the link inside your Dockerfile to the image. 因此,将Dockerfile中的链接添加到映像。

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

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