简体   繁体   English

有没有办法可以将挂载点文件从 Windows 主机绑定到 linux 容器?

[英]Is there a way I can bind mount dot files from a windows host to a linux container?

I am attempting to mount a file from my Windows (Host) to my Linux (Container).我正在尝试将文件从我的Windows (主机)挂载到我的Linux (容器)。 When I mount a single file with a standard extension, everything seems to work fine.当我挂载具有标准扩展名的单个文件时,一切似乎都正常。 However, when I attempt to mount a single file that is a dot-file, it does not work.但是,当我尝试挂载一个点文件的单个文件时,它不起作用。

//This does not work
type=bind,source=${env:USERPROFILE}\\.sample,target=/home/.sample,consistency=cached

// This does work
type=bind,source=${env:USERPROFILE}\\sample.txt,target=/home/sample.txt,consistency=cached

I'm not sure how to specify that the file is a dot file.我不确定如何指定该文件是点文件。 I did notice that if the file did not exist, a folder named .sample was created on my Windows (Host) machine, but that same folder was not created on Linux (Container).我确实注意到,如果该文件不存在,则会在我的 Windows(主机)机器上创建一个名为.sample的文件夹,但在 Linux(容器)上没有创建同一个文件夹。

Are you sure they aren't there?你确定他们不在? Linux treats dotfiles as hidden files, so they aren't visible by just doing an ls command. Linux 将点文件视为隐藏文件,因此仅通过执行ls命令就看不到它们。

You can use ls -A which should show you the hidden dotfiles.您可以使用ls -A来显示隐藏的点文件。

暂无
暂无

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

相关问题 如何从 windows 主机访问我的设备到 docker linux 容器? - How can I access my device from a windows host to a docker linux container? 如何将 windows 共享挂载到 pod 和 linux 主机内的 linux 容器中(Windows 共享在代理身份验证之后。) - How to mount a windows share to a pod and into linux container inside a linux host (Windows share is behind proxy auth.) Windows 主机 Docker + WSL2 - 如何将 Windows 目录挂载到 ZEDC9F0A5A5D57797BF68E373674 容器 - Windows Host Docker + WSL2 - How to mount Windows directory to a Linux container 在 Docker 容器 (Linux) 中挂载 Windows 网络驱动器 - Mount Windows network drive in Docker container (Linux) 在Linux主机上运行Windows容器 - Running windows container on linux host 将 Docker buildx 构建器从主机“挂载”到容器 - "Mount" a Docker buildx builder from host to container 我可以在 WSL 2 中使用 Docker 的 Linux 文件系统来绑定挂载目录而不是安装 Linux 发行版吗? - Can I use Docker's Linux filesystem in WSL 2 to bind mount a directory instead of installing a Linux distro? 无法绑定在 Linux SQL 服务器中安装 Windows 文件夹 Z05B6053C41A2130AFDZimageBDAE1 - Unable to bind mount a Windows folder in a Linux SQL Server docker image Windows Host和Linux Docker Container之间的通信 - Communication between Windows Host and Linux Docker Container 如何在 linux 主机上运行 windows docker 容器? - How to run a windows docker container on linux host?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM