在Docker Desktop的 Forgejo容器中,无法为DDEV的新项目克隆仓库
-- 我正在将开发环境从 Docker desktop 容器迁移到 DDEV(在WSL2中运行Docker CE)的过程中。
-- 安装一切正常,DDEV正在工作,Docker Desktop也在工作(尚未删除它)。
-- 对于版本控制,我使用Forgejo(一个与Git兼容的系统/当前在Docker Desktop的容器内)。
我可以在浏览器中打开Forgejo仓库,功能正常(地址:http://localhost:3004/myUser/store)。
提交也能正常工作,仓库站点正在更新。
-- 现在,在DDEV的新项目中(地址:https://store.ddev.site)我尝试从Docker Desktop的仓库克隆项目。
不幸地,无法工作!
我遇到了连接错误!
fatal: 无法访问 'http://localhost:3004/myUser/store.git/': 在1 毫秒后无法连接到本地端口3004:无法连接到服务器。
(也尝试了以下IP地址:127.0.0.1:3004 / 192.168.2.1:3004 / 0.0.0.0:3004,均未成功)。
为了在DDEV的新项目中从Docker Desktop能正常工作的仓库克隆,我还缺少什么?
欢迎任何提示和想法!
解决方案
If using WSL2 consider setting up mirroring 模式 (https://docs.ddev.com/en/stable/)
After settting this up connection beween Docker desktop and DDEV is working - and as a result git clone works as expected!
WSL2的镜像模式
If you’re using Windows WSL2 with “Mirrored” networking mode, enable the experimental hostAddressLoopback=true 设置。
你可以通过 “WSL设置” 应用来完成此操作:
- 网络设置 > 网络模式:设为“镜像”
- 网络设置 > 主机地址回环:开启