我想使用Podman进行本地开发。我的想法是使用本地文件夹并将其与容器同步,以便在容器中运行我的应用程序。
我发现,如果我在使用Docker时使用的-v
选项,可以在服务器机器上使用,正如文档中所说的-v Bind mount a volume into the container. Volume src will be on the server machine, not the client
。因此,当我使用该选项时,文件夹未被挂载,并且我无法通过podman exec -it application bash
访问它。
有没有办法解决这个问题? 我想要类似于以下命令的功能:
docker run -v localFolder:/remoteFolder application
其中localFolder
是我本地机器上的路径,将映射到容器中的remoteFolder
。
init -v ${HOME}:${HOME}
呢?有任何安全隐患吗? - Andrei默认操作系统中,根文件系统以只读方式挂载,因此必须在 /mnt 目录下创建挂载点。
https://docs.podman.io/en/latest/markdown/podman-machine-init.1.html 或许是时间改变了一些东西。谢谢 @Andrei! 我已经更新了回答。 - zhigang