![](/img/trans.png)
[英]Error while deploying R using plumber in Google App Engine Flex with Docker
[英]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.