Hi Everyone,
I am new to GCP, and am trying to deploy a simple R script in a Docker container that connects to BigQuery and writes the system time.
So far, I have:
1.- Written the R script (see below)
2.- Written the Dockerfile (see below)
3.- Successfully run the container locally on my machine, with the system time being written to BigQuery
4.- Pushed the container to my container registry
When I try to deploy the container to Cloud Run (fully managed) I get this error:
"Cloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information. Logs URL:
https://console.cloud.google.com/logs/xxxxxx"
When I review the log, I find these noteworthy entries:
1.- A warning that says "Container called exit(0)"
2.- Two bugs that say "Container Sandbox: Unsupported syscall setsockopt(0x8,0x0,0xb,0x3e78729eedc4,0x4,0x8). It is very likely that you can safely ignore this message and that this is not the cause of any error you might be troubleshooting. Please, refer to
https://gvisor.dev/c/linux/amd64/setsockopt for more information."
When I check BigQuery, I find that the system time was written, even though the container failed to deploy.
What does this error mean? How can it be fixed? I'd greatly appreciate input as I'm totally stuck!
Thank you!
- H.
==========
R SCRIPT:
# packages
library(bigrquery)
library(tidyverse)
# authentication
bq_auth("/home/rstudio/xxxx-xxxx.json", email="xxxx-at-xxxx.com")
# data
project = "xxxx-project"
dataset = "xxxx-dataset"
table = "xxxx-table"
# create table reference
job = insert_upload_job(project=project, data=dataset, table=table, write_disposition="WRITE_APPEND",
values=Sys.time() %>% as_tibble(), billing=project)
==========
DOCKERFILE:
FROM rocker/tidyverse:latest
RUN R -e "install.packages('bigrquery', repos='http://cran.us.r-project.org')"
ADD xxxx-xxxx.json /home/rstudio
ADD big-query-tutorial_forQuestion.R /home/rstudio
EXPOSE 8080
CMD ["Rscript", "/home/rstudio/big-query-tutorial.R", "--host", "0.0.0.0"]