PR *_*ead 3 macos docker docker-compose macos-ventura
我遇到了 MacOS Ventura 的问题,其中创建的所有绑定卷(我将主机上的目录链接到容器上的目录)docker-compose都是空的。我在 MacOS 12.4 和 12.6 上测试了相同的脚本,它们按预期工作,为我提供了容器上与主机上相同的目录内容,因此 v13 似乎更改了一些权限。
文件docker-compose.yml:
version: "3"\n\nservices:\n bash:\n image: ubuntu:latest\n stdin_open: true\n tty: true\n volumes:\n - ./:/app\n command: "/bin/bash"\nRun Code Online (Sandbox Code Playgroud)\n因此,这应该在名为 的容器上创建一个目录/app,并将其链接到撰写文件所在的主机目录。
但是当我启动容器时:
\n\xe2\x9d\xaf docker-compose up --build\n[+] Running 1/0\n \xe2\xa0\xbf Container ruby-docker-bash-1 Created 0.0s\nAttaching to ruby-docker-bash-1\nRun Code Online (Sandbox Code Playgroud)\n并登录,/app目录为空:
\xe2\x9d\xaf docker exec -it ruby-docker-bash-1 /bin/bash\nroot@9644de175d48:/# cd app/\nroot@9644de175d48:/app# ls -la\ntotal 4\ndrwxr-xr-x 2 root root 40 Feb 1 09:59 .\ndrwxr-xr-x 1 root root 4096 Feb 1 09:39 ..\nRun Code Online (Sandbox Code Playgroud)\n这里真的total 4很奇怪,因为有 4 个文件应该在那里,但无法访问:
root@9644de175d48:/app# cat Gemfile\ncat: Gemfile: No such file or directory\nRun Code Online (Sandbox Code Playgroud)\n这是主机上的目录内容:
\n\xe2\x9d\xaf ls -la\n.rw-r--r-- 2.7k paul 1 Feb 09:31 Dockerfile\n.rw-r--r-- 3.9k paul 1 Feb 09:32 Gemfile\n.rw-r--r-- 27k paul 1 Feb 09:32 Gemfile.lock\n.rw-r--r-- 149 paul 1 Feb 10:00 docker-compose.yml\nRun Code Online (Sandbox Code Playgroud)\n如果有人对可能出现的问题或我如何克服这个绝对耗时的问题有任何经验,我将非常感激。
\n谢谢你!
\n我想到了。我在 MacOS 上使用 Colima,因为 docker 没有 MacOS VM。
\n然后我发现了关于 Colima 存储库问题的评论,https://github.com/abiosoft/colima/issues/500#issuecomment-1343103477,其中用户提到他们无法同步目录。
\n为了修复 MacOS 上的卷,我使用 Colima 执行了以下操作:
\ncolima delete # reset\ncolima start --mount-type 9p\nRun Code Online (Sandbox Code Playgroud)\n这似乎没有任何地方记录。我\xe2\x80\x99已经浏览过该网站,自述文件。
\nvirtiofsMacOS 13 中的 I\xe2\x80\x99m,因此旧安装类型似乎存在问题,但不存在问题9p。
| 归档时间: |
|
| 查看次数: |
1423 次 |
| 最近记录: |