Tools: Dev server used from plymer serve is not accessible from IP address

Created on 9 Dec 2016  路  8Comments  路  Source: Polymer/tools

Description

I've created a docker container with node:6.9.1, compass, bower, gulp, polymer-cli installed. Exposed port 8080.
Mounted the https://codelabs.developers.google.com/codelabs/polymer-2-carousel/ sample project to the app folder of my container.
Now when I start my container and run polymer serve I could access the page using localhost:8080 inside my container. But the same is not accessible from the host machine using the container's IP address and the port.

Versions & Environment

  • Polymer CLI: 0.17.0
  • node: v6.9.1
  • Operating System: Linux cf286dfea7d7 3.13.0-105-generic #152-Ubuntu SMP Fri Dec 2 15:37:11 UTC 2016 x86_64 GNU/Linux

Steps to Reproduce

  1. Start the docker container with polymer serve as the command
  2. try to access the dev server using the IP address of the host from browser

Expected Results

The web application index.html is rendered

Actual Results

Connecting to 172.19.0.2:8080... failed: Connection refused.

cli

Most helpful comment

try polymer serve --hostname 0.0.0.0. Information on this was just added to the README

All 8 comments

try polymer serve --hostname 0.0.0.0. Information on this was just added to the README

Thank you very much @FredKSchott it works with the proposed solution.

馃憤

It is broken again from polymer-cli 0.18.0. :(

0.17.0 works as expected.

Can we re-open @FredKSchott?

@NicolasRannou do you have more details? There wasn't an actual fix for this, besides using the --hostname flag. What exactly isn't working?

@justinfagnani sure! I dig up a bit to get more details and here is the results:

As you know - starting the polymer server in the docker container as: polymer serve --hostname 0.0.0.0 starts a server on port 8080 by default.

Then I map port 8080 from the container to the host machine port 8050.

=> I can not access the content being served by polymer from the host on port 8050.

If I run polymer serve --hostname 0.0.0.0 --port 8080 instead of polymer serve --hostname 0.0.0.0 in the container, then the mapping works properly and I can access my app from the host.

Does it make sense? Can you see why explicitly setting port would work?

Thanks! No big deal anyway as we know the workaround for now -

@NicolasRannou The default port being served is 8081 so if you're mapping 8080 that could be why?

Wow yes I missed that sorry about it :/

So I guess the default port switch happened between v17 and v18, I thought it was only live in the @next version.

Thanks and sorry for the noise @justinfagnani @jsilvermist

Was this page helpful?
0 / 5 - 0 ratings