带有docker'无法访问网站'的google app引擎 [英] google app engine flexible with docker 'site cannot be reached'

查看:115
本文介绍了带有docker'无法访问网站'的google app引擎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用App Engine服务器R模型. 我正在按照此示例 R与应用引擎,但是卡住了.我尝试了几种方法,但是仍然有问题.关于这个问题有什么指导吗?

I want to server R model using App Engine. I am following this example R with app engine, but stuck. I tried several methods but still have issues. Any guidance on this issue?

请参考我的代码 app.yaml

runtime: custom
env: flex

Dockerfile

FROM gcr.io/gcer-public/plumber-appengine
LABEL maintainer="mark"

RUN R -e "install.packages(c('plumber'), repos='http://cran.rstudio.com/')"

WORKDIR /payload/
COPY [".", "./"]

EXPOSE 8080
ENTRYPOINT ["R", "-e", "pr <- plumber::plumb(commandArgs()[4]); pr$run(host='0.0.0.0', port=8080)"]
CMD ["schedule.R"]

schedule.R

#* @get /demoR
get_predict_length <- function(){

  dataset <- iris

  # create the model
  model <- lm(Petal.Length ~ Petal.Width, data = dataset)
  petal_width = "0.4"

  #petal_width = '0.4'
  # convert the input to a number
  petal_width <- as.numeric(petal_width)

  #create the prediction data frame
  prediction_data <- data.frame(Petal.Width=petal_width)

  # create the prediction
  predict(model,prediction_data)
}

我使用'gcloud app deploy进行部署,并且部署成功.我得到一个链接" https://iris-custom-dot-my- project-name.appspot.com/'.

I deploy using 'gcloud app deploy and its successful. I get a link 'https://iris-custom-dot-my-project-name.appspot.com/'.

日志中的最终输出

Stackdriver日志显示:

Stackdriver logs show:

  Starting server to listen on port 8080   

当我点击应用引擎版本 https://iris-custom -dot-my-project-name.appspot.com/',我收到以下消息:

when I click on app engine version https://iris-custom-dot-my-project-name.appspot.com/' , I get below message:

无法访问此网站

推荐答案

办公室网络问题

在我的情况下,真正的问题是,我的办公室网络阻止了8080端口,因此当我通过移动热点从家中或在办公室连接时,它可以正常工作.

In my case the real issue was, my office network blocked port 8080, so when I connected from home or in office over mobile hotspot, it worked.

通常,请按照以下步骤解决问题.

1)搜索Google 我的公共IP地址"

1) search google 'my public IP address"

2)在防火墙规则中添加IP将解决此问题.

2) Add your IP in firewall rules will resolve the issue.

使用gcloud命令

https://cloud.google.com/sdk/gcloud/reference/app/firewall-rules/create

使用GCP用户界面(您可以使用尚未使用的任何优先级数字)

using GCP UI ( you can use any priority number which has not been used already)

这篇关于带有docker'无法访问网站'的google app引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆