Issue
I'm trying to use ionic serve
to access a blank ionic template. It says it's working, but I just get 'page not found' in Chrome. I'm pretty confident that the ports are not the issue, since I can reach the live reload page on http://192.168.99.100:35729 and if I swap them, on http://192.168.99.100:8100.
nmap tells me:
PORT STATE SERVICE
8100/tcp closed xprint-server
I'm also using Docker. 192.168.99.100 is the IP of my VM.
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
If it helps, here is my 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"]
This is the result of docker port
when applied to the container:
35729/tcp -> 0.0.0.0:35729 8100/tcp -> 0.0.0.0:8100
Solution
Ionic has currently a problem listening/binding to 0.0.0.0. This is fixed in the new beta. There is a workaround mentioned in this thread:
source: https://github.com/driftyco/ionic-cli/issues/322
My workaround was add this line on my Dockerfile:
RUN sed -i 's/localhost/0.0.0.0/' /usr/lib/node_modules/ionic/lib/ionic/serve.js
Or in some cases (depending on the version):
RUN sed -i 's/localhost/0.0.0.0/' /usr/lib/node_modules/ionic/lib/serve.js
Answered By - Nik
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.