GCP instance returns ERR_CONNECTION_REFUSED for Ajax 127.0.0.1 routeHow to access host port from docker containerdocker docker0 and container broadcast addresses not setFlask server doesn't render bokeh charts in remoteFlask allows multiple server instances to listen on the same portHow to access an internal server within a docker container?flask bokeh server- figure does not render (ubuntu) but works on local machineBind docker container loopback to the host loopbackflask not binding to 0.0.0.0Flask on Google Compute Engine - cant reach from outside/browserunable to access server in docker container from outside host machineFlask + Bokeh Server on Azure Web App Service
Does this website provide consistent translation into Wookiee?
How to get the decimal part of a number in apex
Why were the rules for Proliferate changed?
Justification of physical currency in an interstellar civilization?
Is throwing dice a stochastic or a deterministic process?
shebang or not shebang
How to make a kid's bike easier to pedal
Gift for mentor after his thesis defense?
If quadruped mammals evolve to become bipedal will their breast or nipple change position?
What's the 2-minute timer on mobile Deutsche Bahn tickets?
How is it believable that Euron could so easily pull off this ambush?
How can I test a shell script in a "safe environment" to avoid harm to my computer?
Translation of "invincible independence"
Clauses with 3 infinitives at the end
Does every non-empty set admit an (affine) scheme structure (in ZFC)?
Displaying an Estimated Execution Plan generates CXPACKET, PAGELATCH_SH, and LATCH_EX [ACCESS_METHODS_DATASET_PARENT] waits
What is the meaning of "matter" in physics?
LiOH hydrolysis of methyl 2,2-dimethoxyacetate not giving product?
Is it safe to keep the GPU on 100% utilization for a very long time?
What detail can Hubble see on Mars?
Did any early RISC OS precursor run on the BBC Micro?
What's weird about Proto-Indo-European Stops?
What does the copyright in a dissertation protect exactly?
The unknown and unexplained in science fiction
GCP instance returns ERR_CONNECTION_REFUSED for Ajax 127.0.0.1 route
How to access host port from docker containerdocker docker0 and container broadcast addresses not setFlask server doesn't render bokeh charts in remoteFlask allows multiple server instances to listen on the same portHow to access an internal server within a docker container?flask bokeh server- figure does not render (ubuntu) but works on local machineBind docker container loopback to the host loopbackflask not binding to 0.0.0.0Flask on Google Compute Engine - cant reach from outside/browserunable to access server in docker container from outside host machineFlask + Bokeh Server on Azure Web App Service
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a flask application using bokeh that is running in a Docker container, and it works when I use it on local machines.
However, when I deploy it to a GCP instance, even though I can reach the server, I have some AjaxDataSource() objects which are failing to connect.
Some details,
- All the machines, local and gcp vm are running Ubuntu 18.04
The flask app is started like this,
app.run(host="0.0.0.0", port=6600, debug=False)
The Ajax route looks like this,
http://127.0.0.1:6600/land/tmidemo/data_rate?name=ResultBaseKeysV1
The GCP firewall rules look like,
Name Type Targets Filters Protocols / ports Action Priority Network
tmiserver-egress Egress Apply to all IP ranges: 0.0.0.0/0 tcp:6600 udp:6600 Allow 1000 default
tmiserver-ingress Ingress Apply to all IP ranges: 0.0.0.0/0 tcp:6600 udp:6600 Allow 1000 defaultThe docker container is run like this,
docker run --net tminet --hostname=TEST -p 6600:6600 -v $(pwd):/app/public --name myserver --rm myserver
I am not using a Bokeh server. The AjaxDataSource() calls point back to the flask application, not another (bokeh) server
There is a lot that works,
- able to use the GCP external ip address and reach the server
- going from web page to web page works, so flask routing is working
Whats NOT working is that Ajax() call which uses 127.0.0.1
, although this DOES work when I run the container on a local machine.
The error I see in the inspect window is ERR_CONNECTION_REFUSED
The GCP instance hosts.conf
DOES include a line for 127.0.0.1 localhost
I tried (from here) on the GCP VM instance, same result,
iptables -A INPUT -i docker0 -j ACCEPT
I also tried (from here) changing the Docker run network to --net="host"
and the result is identical.
I also tried adding --add-host localhost:127.0.0.1
to the Docker run command, same result.
I think the problem is configuring the GCP to know how to route a request to 127.0.0.1
, but I don't know where to check, configure this, beyond what I have already done.
python docker flask google-cloud-platform bokeh
|
show 1 more comment
I have a flask application using bokeh that is running in a Docker container, and it works when I use it on local machines.
However, when I deploy it to a GCP instance, even though I can reach the server, I have some AjaxDataSource() objects which are failing to connect.
Some details,
- All the machines, local and gcp vm are running Ubuntu 18.04
The flask app is started like this,
app.run(host="0.0.0.0", port=6600, debug=False)
The Ajax route looks like this,
http://127.0.0.1:6600/land/tmidemo/data_rate?name=ResultBaseKeysV1
The GCP firewall rules look like,
Name Type Targets Filters Protocols / ports Action Priority Network
tmiserver-egress Egress Apply to all IP ranges: 0.0.0.0/0 tcp:6600 udp:6600 Allow 1000 default
tmiserver-ingress Ingress Apply to all IP ranges: 0.0.0.0/0 tcp:6600 udp:6600 Allow 1000 defaultThe docker container is run like this,
docker run --net tminet --hostname=TEST -p 6600:6600 -v $(pwd):/app/public --name myserver --rm myserver
I am not using a Bokeh server. The AjaxDataSource() calls point back to the flask application, not another (bokeh) server
There is a lot that works,
- able to use the GCP external ip address and reach the server
- going from web page to web page works, so flask routing is working
Whats NOT working is that Ajax() call which uses 127.0.0.1
, although this DOES work when I run the container on a local machine.
The error I see in the inspect window is ERR_CONNECTION_REFUSED
The GCP instance hosts.conf
DOES include a line for 127.0.0.1 localhost
I tried (from here) on the GCP VM instance, same result,
iptables -A INPUT -i docker0 -j ACCEPT
I also tried (from here) changing the Docker run network to --net="host"
and the result is identical.
I also tried adding --add-host localhost:127.0.0.1
to the Docker run command, same result.
I think the problem is configuring the GCP to know how to route a request to 127.0.0.1
, but I don't know where to check, configure this, beyond what I have already done.
python docker flask google-cloud-platform bokeh
What is your command for starting Bokeh server? Do you use the --allow-websocket-origin IP_ADDRESS to white-list the IP_ADDRESS from which you access the Bokeh server?
– Tony
Mar 23 at 8:49
Shouldn't your Ajax calls target your VM's external IP instead of localhost?
– LundinCast
Mar 23 at 12:22
@tony I am not using a Bokeh server.
– user9277612
Mar 23 at 15:45
@LundinCast That might work, and I plan to test that as an experiment. Using the VM's external IP address is not a good idea because that IP address is not static. Using localhost (127.0.0.1) should work for any deployment, and it does on physical machines, just not on GCP VM.
– user9277612
Mar 23 at 15:48
Docker internal port mapping is dynamic but on your host machine you can use this approach to get all the info that you need: 1) In you "Docker run command" name your Docker container explicitly using ''--name=YOUR_CONTAINER_NAME'' 2) Use ''docker port YOUR_CONTAINER_NAME'' to show port mapping
– Tony
Mar 24 at 10:09
|
show 1 more comment
I have a flask application using bokeh that is running in a Docker container, and it works when I use it on local machines.
However, when I deploy it to a GCP instance, even though I can reach the server, I have some AjaxDataSource() objects which are failing to connect.
Some details,
- All the machines, local and gcp vm are running Ubuntu 18.04
The flask app is started like this,
app.run(host="0.0.0.0", port=6600, debug=False)
The Ajax route looks like this,
http://127.0.0.1:6600/land/tmidemo/data_rate?name=ResultBaseKeysV1
The GCP firewall rules look like,
Name Type Targets Filters Protocols / ports Action Priority Network
tmiserver-egress Egress Apply to all IP ranges: 0.0.0.0/0 tcp:6600 udp:6600 Allow 1000 default
tmiserver-ingress Ingress Apply to all IP ranges: 0.0.0.0/0 tcp:6600 udp:6600 Allow 1000 defaultThe docker container is run like this,
docker run --net tminet --hostname=TEST -p 6600:6600 -v $(pwd):/app/public --name myserver --rm myserver
I am not using a Bokeh server. The AjaxDataSource() calls point back to the flask application, not another (bokeh) server
There is a lot that works,
- able to use the GCP external ip address and reach the server
- going from web page to web page works, so flask routing is working
Whats NOT working is that Ajax() call which uses 127.0.0.1
, although this DOES work when I run the container on a local machine.
The error I see in the inspect window is ERR_CONNECTION_REFUSED
The GCP instance hosts.conf
DOES include a line for 127.0.0.1 localhost
I tried (from here) on the GCP VM instance, same result,
iptables -A INPUT -i docker0 -j ACCEPT
I also tried (from here) changing the Docker run network to --net="host"
and the result is identical.
I also tried adding --add-host localhost:127.0.0.1
to the Docker run command, same result.
I think the problem is configuring the GCP to know how to route a request to 127.0.0.1
, but I don't know where to check, configure this, beyond what I have already done.
python docker flask google-cloud-platform bokeh
I have a flask application using bokeh that is running in a Docker container, and it works when I use it on local machines.
However, when I deploy it to a GCP instance, even though I can reach the server, I have some AjaxDataSource() objects which are failing to connect.
Some details,
- All the machines, local and gcp vm are running Ubuntu 18.04
The flask app is started like this,
app.run(host="0.0.0.0", port=6600, debug=False)
The Ajax route looks like this,
http://127.0.0.1:6600/land/tmidemo/data_rate?name=ResultBaseKeysV1
The GCP firewall rules look like,
Name Type Targets Filters Protocols / ports Action Priority Network
tmiserver-egress Egress Apply to all IP ranges: 0.0.0.0/0 tcp:6600 udp:6600 Allow 1000 default
tmiserver-ingress Ingress Apply to all IP ranges: 0.0.0.0/0 tcp:6600 udp:6600 Allow 1000 defaultThe docker container is run like this,
docker run --net tminet --hostname=TEST -p 6600:6600 -v $(pwd):/app/public --name myserver --rm myserver
I am not using a Bokeh server. The AjaxDataSource() calls point back to the flask application, not another (bokeh) server
There is a lot that works,
- able to use the GCP external ip address and reach the server
- going from web page to web page works, so flask routing is working
Whats NOT working is that Ajax() call which uses 127.0.0.1
, although this DOES work when I run the container on a local machine.
The error I see in the inspect window is ERR_CONNECTION_REFUSED
The GCP instance hosts.conf
DOES include a line for 127.0.0.1 localhost
I tried (from here) on the GCP VM instance, same result,
iptables -A INPUT -i docker0 -j ACCEPT
I also tried (from here) changing the Docker run network to --net="host"
and the result is identical.
I also tried adding --add-host localhost:127.0.0.1
to the Docker run command, same result.
I think the problem is configuring the GCP to know how to route a request to 127.0.0.1
, but I don't know where to check, configure this, beyond what I have already done.
python docker flask google-cloud-platform bokeh
python docker flask google-cloud-platform bokeh
edited Mar 23 at 21:54
user9277612
asked Mar 23 at 6:20
user9277612user9277612
408
408
What is your command for starting Bokeh server? Do you use the --allow-websocket-origin IP_ADDRESS to white-list the IP_ADDRESS from which you access the Bokeh server?
– Tony
Mar 23 at 8:49
Shouldn't your Ajax calls target your VM's external IP instead of localhost?
– LundinCast
Mar 23 at 12:22
@tony I am not using a Bokeh server.
– user9277612
Mar 23 at 15:45
@LundinCast That might work, and I plan to test that as an experiment. Using the VM's external IP address is not a good idea because that IP address is not static. Using localhost (127.0.0.1) should work for any deployment, and it does on physical machines, just not on GCP VM.
– user9277612
Mar 23 at 15:48
Docker internal port mapping is dynamic but on your host machine you can use this approach to get all the info that you need: 1) In you "Docker run command" name your Docker container explicitly using ''--name=YOUR_CONTAINER_NAME'' 2) Use ''docker port YOUR_CONTAINER_NAME'' to show port mapping
– Tony
Mar 24 at 10:09
|
show 1 more comment
What is your command for starting Bokeh server? Do you use the --allow-websocket-origin IP_ADDRESS to white-list the IP_ADDRESS from which you access the Bokeh server?
– Tony
Mar 23 at 8:49
Shouldn't your Ajax calls target your VM's external IP instead of localhost?
– LundinCast
Mar 23 at 12:22
@tony I am not using a Bokeh server.
– user9277612
Mar 23 at 15:45
@LundinCast That might work, and I plan to test that as an experiment. Using the VM's external IP address is not a good idea because that IP address is not static. Using localhost (127.0.0.1) should work for any deployment, and it does on physical machines, just not on GCP VM.
– user9277612
Mar 23 at 15:48
Docker internal port mapping is dynamic but on your host machine you can use this approach to get all the info that you need: 1) In you "Docker run command" name your Docker container explicitly using ''--name=YOUR_CONTAINER_NAME'' 2) Use ''docker port YOUR_CONTAINER_NAME'' to show port mapping
– Tony
Mar 24 at 10:09
What is your command for starting Bokeh server? Do you use the --allow-websocket-origin IP_ADDRESS to white-list the IP_ADDRESS from which you access the Bokeh server?
– Tony
Mar 23 at 8:49
What is your command for starting Bokeh server? Do you use the --allow-websocket-origin IP_ADDRESS to white-list the IP_ADDRESS from which you access the Bokeh server?
– Tony
Mar 23 at 8:49
Shouldn't your Ajax calls target your VM's external IP instead of localhost?
– LundinCast
Mar 23 at 12:22
Shouldn't your Ajax calls target your VM's external IP instead of localhost?
– LundinCast
Mar 23 at 12:22
@tony I am not using a Bokeh server.
– user9277612
Mar 23 at 15:45
@tony I am not using a Bokeh server.
– user9277612
Mar 23 at 15:45
@LundinCast That might work, and I plan to test that as an experiment. Using the VM's external IP address is not a good idea because that IP address is not static. Using localhost (127.0.0.1) should work for any deployment, and it does on physical machines, just not on GCP VM.
– user9277612
Mar 23 at 15:48
@LundinCast That might work, and I plan to test that as an experiment. Using the VM's external IP address is not a good idea because that IP address is not static. Using localhost (127.0.0.1) should work for any deployment, and it does on physical machines, just not on GCP VM.
– user9277612
Mar 23 at 15:48
Docker internal port mapping is dynamic but on your host machine you can use this approach to get all the info that you need: 1) In you "Docker run command" name your Docker container explicitly using ''--name=YOUR_CONTAINER_NAME'' 2) Use ''docker port YOUR_CONTAINER_NAME'' to show port mapping
– Tony
Mar 24 at 10:09
Docker internal port mapping is dynamic but on your host machine you can use this approach to get all the info that you need: 1) In you "Docker run command" name your Docker container explicitly using ''--name=YOUR_CONTAINER_NAME'' 2) Use ''docker port YOUR_CONTAINER_NAME'' to show port mapping
– Tony
Mar 24 at 10:09
|
show 1 more comment
1 Answer
1
active
oldest
votes
I wasn't able to specifically resolve the issue I was having, but I tried a different approach to the URL for the AjaxDataSource()
and it worked and I think a better approach...
I used Flask url_for()
function to create a link to the route that the AjaxDataSource()
needs and this worked. The resulting link looks something like,
/land/tmidemo/data_rate/ResultBaseKeysV1
ie, no http://127.0.0.1
, and this seems to work in all cases, my dev environment and GCP.
I think I tried this a long time ago and it didn't work, because I use "flask" URLs all over the place, but for some reason I thought I needed "http://127.0.0.1" for the Ajax stuff. Its works now.... moving on!
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55311175%2fgcp-instance-returns-err-connection-refused-for-ajax-127-0-0-1-route%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I wasn't able to specifically resolve the issue I was having, but I tried a different approach to the URL for the AjaxDataSource()
and it worked and I think a better approach...
I used Flask url_for()
function to create a link to the route that the AjaxDataSource()
needs and this worked. The resulting link looks something like,
/land/tmidemo/data_rate/ResultBaseKeysV1
ie, no http://127.0.0.1
, and this seems to work in all cases, my dev environment and GCP.
I think I tried this a long time ago and it didn't work, because I use "flask" URLs all over the place, but for some reason I thought I needed "http://127.0.0.1" for the Ajax stuff. Its works now.... moving on!
add a comment |
I wasn't able to specifically resolve the issue I was having, but I tried a different approach to the URL for the AjaxDataSource()
and it worked and I think a better approach...
I used Flask url_for()
function to create a link to the route that the AjaxDataSource()
needs and this worked. The resulting link looks something like,
/land/tmidemo/data_rate/ResultBaseKeysV1
ie, no http://127.0.0.1
, and this seems to work in all cases, my dev environment and GCP.
I think I tried this a long time ago and it didn't work, because I use "flask" URLs all over the place, but for some reason I thought I needed "http://127.0.0.1" for the Ajax stuff. Its works now.... moving on!
add a comment |
I wasn't able to specifically resolve the issue I was having, but I tried a different approach to the URL for the AjaxDataSource()
and it worked and I think a better approach...
I used Flask url_for()
function to create a link to the route that the AjaxDataSource()
needs and this worked. The resulting link looks something like,
/land/tmidemo/data_rate/ResultBaseKeysV1
ie, no http://127.0.0.1
, and this seems to work in all cases, my dev environment and GCP.
I think I tried this a long time ago and it didn't work, because I use "flask" URLs all over the place, but for some reason I thought I needed "http://127.0.0.1" for the Ajax stuff. Its works now.... moving on!
I wasn't able to specifically resolve the issue I was having, but I tried a different approach to the URL for the AjaxDataSource()
and it worked and I think a better approach...
I used Flask url_for()
function to create a link to the route that the AjaxDataSource()
needs and this worked. The resulting link looks something like,
/land/tmidemo/data_rate/ResultBaseKeysV1
ie, no http://127.0.0.1
, and this seems to work in all cases, my dev environment and GCP.
I think I tried this a long time ago and it didn't work, because I use "flask" URLs all over the place, but for some reason I thought I needed "http://127.0.0.1" for the Ajax stuff. Its works now.... moving on!
answered Mar 24 at 17:14
user9277612user9277612
408
408
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55311175%2fgcp-instance-returns-err-connection-refused-for-ajax-127-0-0-1-route%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What is your command for starting Bokeh server? Do you use the --allow-websocket-origin IP_ADDRESS to white-list the IP_ADDRESS from which you access the Bokeh server?
– Tony
Mar 23 at 8:49
Shouldn't your Ajax calls target your VM's external IP instead of localhost?
– LundinCast
Mar 23 at 12:22
@tony I am not using a Bokeh server.
– user9277612
Mar 23 at 15:45
@LundinCast That might work, and I plan to test that as an experiment. Using the VM's external IP address is not a good idea because that IP address is not static. Using localhost (127.0.0.1) should work for any deployment, and it does on physical machines, just not on GCP VM.
– user9277612
Mar 23 at 15:48
Docker internal port mapping is dynamic but on your host machine you can use this approach to get all the info that you need: 1) In you "Docker run command" name your Docker container explicitly using ''--name=YOUR_CONTAINER_NAME'' 2) Use ''docker port YOUR_CONTAINER_NAME'' to show port mapping
– Tony
Mar 24 at 10:09