使用离子服务时无法访问dev服务器

我正在尝试使用ionic serve来访问一个空白的离子模板。 它说它正在工作,但我只是在Chrome中find“页面未find”。 我非常自信,端口不是问题,因为我可以到达http://192.168.99.100:35729上的实时重载页面,如果我交换它们,在http://192.168.99.100:8100 。

nmap告诉我:

 PORT STATE SERVICE 8100/tcp closed xprint-server 

我也在使用Docker。 192.168.99.100是我的虚拟机的IP。

 Adrians-iMac:kosher_app Adrian$ docker run -p 8100:8100 -p 35729:35729 -v /Users/Adrian/Documents/current_projects/kosher_app/kosher:/ionic -i -t app serve Running dev server: http://localhost:8100 Running live reload server: http://localhost:35729 Watching : [ 'www/**/*', '!www/lib/**/*' ] Ionic server commands, enter: restart or r to restart the client app from the root goto or g and a url to have the app navigate to the given url consolelogs or c to enable/disable console log output serverlogs or s to enable/disable server log output quit or q to shutdown the server and exit 

如果有帮助,这是我的Dockerfile:

 FROM google/nodejs WORKDIR /ionic VOLUME ["/ionic"] RUN npm install -g cordova ionic && ionic platform add android EXPOSE 8100 EXPOSE 35729 ENTRYPOINT ["ionic"] CMD ["serve"] 

这是docker port应用于容器时的结果:

 35729/tcp -> 0.0.0.0:35729 8100/tcp -> 0.0.0.0:8100 

离子目前有一个问题听/绑定到0.0.0.0。 这是在新的testing版中修复的。 在这个线程中提到了一个解决方法:

来源: https : //github.com/driftyco/ionic-cli/issues/322

 @cef62 I was fighting with this issue too. My workaround was add this line on my Dockerfile: sed -i 's/localhost/0.0.0.0/' /usr/lib/node_modules/ionic/lib/ionic/serve.js