问题描述
我已经在我的 Mac 上安装并设置了 CodeReady 容器,尝试使用示例节点 js 应用程序创建一个项目,但构建失败并在日志中显示此消息。
我们是否需要对 CodeReady 容器进行任何更改才能访问 github.com?
cloning "https://github.com/sclorg/nodejs-ex.git" ...
error: fatal: unable to access 'https://github.com/sclorg/nodejs-ex.git/': Could not resolve host: github.com
解决方法
我在 crc 上试过你的命令。它对我有用。 不需要额外的步骤。
$ oc new-app https://github.com/sclorg/nodejs-ex
--> Found image db4e490 (2 months old) in image stream "openshift/nodejs" under
...
...
Run 'oc status' to view your app.
我假设您可以从您的笔记本电脑访问 github.com。 :)
看看能否从 crc 虚拟机解析 GitHub。
从您的笔记本电脑。
$ host api.crc.testing
$ ssh -i ~/.crc/machines/crc/id_rsa core@192.168.130.11
现在检查你是否可以解析github
[root@crc-fdm75-master-0 ~]$ host github.com
github.com has address 13.234.210.38
github.com mail is handled by 1 aspmx.l.google.com.
github.com mail is handled by 10 alt3.aspmx.l.google.com.
github.com mail is handled by 10 alt4.aspmx.l.google.com.
github.com mail is handled by 5 alt1.aspmx.l.google.com.
github.com mail is handled by 5 alt2.aspmx.l.google.com.
如果它不起作用,那么您的安装有问题。尝试重新进行设置。
crc stop
crc clean-up
crc setup
crc start
让我们看看进展如何。
顺便说一句,我使用 Fedora,而不是 mac。我认为操作系统在这里无关紧要。