问:如何在gcloud计算实例中将docker0接口设置为外部可用IP?

时间:2016-04-06 07:49:05

标签: docker eclipse-che

我在谷歌云平台的CentOS 7实例上本地运行eclipse。 我能够在我的浏览器上获得che界面,但无法启动项目。

来自我的che.properties文件的

machine.docker.local_node_host=172.17.0.1
api.endpoint=http://_my instance external IP_:${SERVER_PORT}/ide/api
来自我的/ etc / hosts

(putted manualy):

 172.17.0.1  che-host 

安装Docker作为预先要求

Docker version 1.10.3, build 20f81dd
来自我的〜/ .bash_profile文件的

export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.77-0.b03.el7_2.x86_64
export CHE_HOME=/opt/eclipse-che-4.1.0
export CHE_LOCAL_CONF_DIR=$CHE_HOME/conf
export CHE_DOCKER_MACHINE_HOST=172.17.0.1

ifconfig输出

docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 0.0.0.0
        inet6 fe80::42:68ff:fe05:66b1  prefixlen 64  scopeid 0x20<link>
        ether 02:42:68:05:66:b1  txqueuelen 0  (Ethernet)
        RX packets 3025  bytes 334688 (326.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2563  bytes 390278 (381.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1460
        inet <google internal network IP for instance>  netmask 255.255.255.255  broadcast 10.132.0.2
        inet6 fe80::4001:aff:fe84:2  prefixlen 64  scopeid 0x20<link>
        ether 42:01:0a:84:00:02  txqueuelen 1000  (Ethernet)
        RX packets 402499  bytes 1381254390 (1.2 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 292323  bytes 58381431 (55.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 1061  bytes 57399 (56.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1061  bytes 57399 (56.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth53e0def: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::1005:77ff:fe1d:83a4  prefixlen 64  scopeid 0x20<link>
        ether 12:05:77:1d:83:a4  txqueuelen 0  (Ethernet)
        RX packets 42  bytes 6574 (6.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 40  bytes 7991 (7.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

受信任区域的firewalld规则

instance-1 ~]$ sudo firewall-cmd --permanent --zone=trusted --list-all
trusted (default, active)
  interfaces: docker0
  sources:
  services:
  ports: 32768-65535/tcp 32768-65535/udp 4243/tcp 4401/tcp 4411/tcp 4403/tcp 22/tcp
  masquerade: no
  forward-ports:
  icmp-blocks:
  rich rules:

浏览器中的che控制台输出

[STDOUT] 2016-04-05 19:40:39,511[main] [INFO] [o.a.c.http11.Http11NioProtocol 470] - Starting ProtocolHandler ["http-nio-4401"]
[STDOUT] 2016-04-05 19:40:39,515[main] [INFO] [o.a.catalina.startup.Catalina 642] - Server startup in 4795 ms
[STDOUT] 2016-04-05 19:40:39,515[main] [INFO] [o.a.catalina.startup.Catalina 642] - Server startup in 4795 ms
[STDOUT] 2016-04-05 19:40:39,712[nio-4401-exec-1] [WARN ] [i.ContainerResponse$BodyWriter 90] - Client has aborted connection. Response writing omitted.
[STDOUT] 2016-04-05 19:40:39,712[nio-4401-exec-1] [WARN ] [i.ContainerResponse$BodyWriter 90] - Client has aborted connection. Response writing omitted.

这发生在启动工作区代理阶段,在以下阶段之后

Initializing workspace ... completed
Starting workspace runtime ... completed
```

我从che github repo的那些人那里得到的答案是:

这里的问题是浏览器尝试连接到工作区代理,它使用CHE_DOCKER_MACHINE_HOST,服务器也使用CHE_DOCKER_MACHINE_HOST ping ws-agent。 因此,docker0应该是外部可用的IP。

所以,我从中了解到172.17.0.1也需要有外部IP, 知道如何将IP从默认的docker0 IP切换到$(document).ready(function() { $(".demoClass").click(function() { $("#dialog-1").dialog({ resizable: false, height: 140, modal: true, buttons: [{ text: "Yes", click: function() { $(this).dialog("close"); }, }, { text: "No", click: function() { $(this).dialog("close"); }, } ], }); }); }); 接口的外部IP吗?

0 个答案:

没有答案