符号链接主机到Docker容器 [英] Symbolic Link Host to Docker Container

查看:684
本文介绍了符号链接主机到Docker容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗯,基本上我想从我的主机到我的容器创建一个符号链接ln -s。总结:主机的主机文件夹.m2必须有一个符号链接到我的容器内的.m2文件夹,类似于:$ ln -s containerIp:



< /root/.m2 myContainerAlias



我看过以下帖子,但他们没有帮助我,因为我不想将文件复制到我的本地主机。 / p>

Docker - 复制文件从容器到主机



Docker中的Apache说:不允许使用符号链接



https://omarabid.com/symlink-to-a-mounted-volume-in-docker/



已编辑:



我在这里发现了另一个有价值的问题:



如何在docker容器中挂载目录到主机?
谢谢...

有关这个问题的进一步调查。我想通知,在以下帖子中,我已经以@Kai Hofstetter的方式解决了我的问题:如何将docker容器中的目录装载到主机?


Well, Basically I wanna create a Symbolic link "ln -s" from my host to my container.

To sum up: the host folder .m2 of the host must have a Symbolic link to the .m2 folder inside my container, something like: $ ln -s containerIp:/root/.m2 myContainerAlias

I've seen the below posts but they didn't help me since I don't wanna copy the files to my local host.

Docker - copy file from container to host

Apache in Docker says: Symbolic link not allowed

https://omarabid.com/symlink-to-a-mounted-volume-in-docker/

Edited:

I've found another valuable Issue here:

How to mount a directory in the docker container to the host? Thanks...

解决方案

For further investigation about this question. I would like to notify that I've "solved" my issue with the same approach than @Kai Hofstetter in the following post: How to mount a directory in the docker container to the host?

这篇关于符号链接主机到Docker容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆