繁体   English   中英

带有docker'无法访问站点'的google app引擎

[英]google app engine flexible with docker 'site cannot be reached'

我想使用App Engine服务器R模型。 我正在使用App Engine跟踪此示例R ,但遇到了麻烦。 我尝试了几种方法,但是仍然有问题。 关于这个问题有什么指导吗?

请参考我的代码app.yaml

runtime: custom
env: flex

Docker文件

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"]

进度表

#* @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应用程序部署及其成功部署”。 我得到一个链接“ https://iris-custom-dot-my-project-name.appspot.com/ ”。

最终日志输出

Stackdriver日志显示:

  Starting server to listen on port 8080   

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

无法访问该网站

办公网络问题

就我而言,真正的问题是,我的办公室网络阻塞了8080端口,因此当我通过移动热点从家中或办公室连接时,它可以正常工作。

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

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

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

要么使用gcloud命令

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

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

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM