inbo / reporting-rshiny-grofwildjacht

Rshiny app for grofwildjacht
https://grofwildjacht.inbo.be/
MIT License
1 stars 1 forks source link

Unable to run private app using docker desktop #400

Closed SanderDevisscher closed 1 year ago

SanderDevisscher commented 1 year ago

@mvarewyck I've got a new laptop and with it came some new(er versions of) applications. The new version (4.20.0) of docker desktop works quite different from the older version I had. With the old version of docker I used windows powershell with this command docker run -p 3838:3838 openanalytics/r-base R -e "Sys.setenv('AWS_DEFAULT_REGION'='eu-west-1', 'AWS_ACCESS_KEY_ID'='<je AWS_ACCESS_KEY_ID>', 'AWS_SECRET_ACCESS_KEY'='<je AWS_SECRET_ACCESS_KEY>'); if I want to check the private app I would just add public=FALSE. With the new docker version I'm unable to run a container using powershell, building the image still works though. I found out I can run a container using the docker desktop app by providing the needed environment variables (AWS keys & region). However when I add public as variable with FALSE/false the variable seems to be not passed on since the public part of the app is run instead.

Do you have an idea how I can run the private app with docker desktop 4.20.0 ? or start using powershell again to run a container ?

mvarewyck commented 1 year ago

New laptops... :)

@SanderDevisscher Is it an option to change the last line in the Dockerfile with the correct command for the private app? Sth like CMD ["R", "-e reportingGrofwild::runWildApp(public = FALSE)"] You will need to re-build the docker image then, but all lines will be cached except for the last one. You can give the image a different name for private/public to not overwrite.

SanderDevisscher commented 1 year ago

When I try this I get an error, see log:

2023-06-06 17:45:23 ARGUMENT '=' __ignored__
2023-06-06 17:45:23 
2023-06-06 17:45:23 ARGUMENT 'FALSE)' __ignored__
2023-06-06 17:45:23 
2023-06-06 17:45:23 
2023-06-06 17:45:23 R version 4.0.5 (2021-03-31) -- "Shake and Throw"
2023-06-06 17:45:23 Copyright (C) 2021 The R Foundation for Statistical Computing
2023-06-06 17:45:23 Platform: x86_64-pc-linux-gnu (64-bit)
2023-06-06 17:45:23 
2023-06-06 17:45:23 R is free software and comes with ABSOLUTELY NO WARRANTY.
2023-06-06 17:45:23 You are welcome to redistribute it under certain conditions.
2023-06-06 17:45:23 Type 'license()' or 'licence()' for distribution details.
2023-06-06 17:45:23 
2023-06-06 17:45:23 R is a collaborative project with many contributors.
2023-06-06 17:45:23 Type 'contributors()' for more information and
2023-06-06 17:45:23 'citation()' on how to cite R or R packages in publications.
2023-06-06 17:45:23 
2023-06-06 17:45:23 Type 'demo()' for some demos, 'help()' for on-line help, or
2023-06-06 17:45:23 'help.start()' for an HTML browser interface to help.
2023-06-06 17:45:23 Type 'q()' to quit R.
2023-06-06 17:45:23 
2023-06-06 17:45:26 > reportingGrofwild::runWildApp(public
2023-06-06 17:45:26 + 
2023-06-06 17:45:26 + 2023-06-06T15:47:03.664227825Z ARGUMENT '=' __ignored__
2023-06-06 17:47:03 
2023-06-06 17:47:03 ARGUMENT 'FALSE)' __ignored__
2023-06-06 17:47:03 
2023-06-06 17:47:03 
2023-06-06 17:47:03 R version 4.0.5 (2021-03-31) -- "Shake and Throw"
2023-06-06 17:47:03 Copyright (C) 2021 The R Foundation for Statistical Computing
2023-06-06 17:47:03 Platform: x86_64-pc-linux-gnu (64-bit)
2023-06-06 17:47:03 
2023-06-06 17:47:03 R is free software and comes with ABSOLUTELY NO WARRANTY.
2023-06-06 17:47:03 You are welcome to redistribute it under certain conditions.
2023-06-06 17:47:03 Type 'license()' or 'licence()' for distribution details.
2023-06-06 17:47:03 
2023-06-06 17:47:03 R is a collaborative project with many contributors.
2023-06-06 17:47:03 Type 'contributors()' for more information and
2023-06-06 17:47:03 'citation()' on how to cite R or R packages in publications.
2023-06-06 17:47:03 
2023-06-06 17:47:03 Type 'demo()' for some demos, 'help()' for on-line help, or
2023-06-06 17:47:03 'help.start()' for an HTML browser interface to help.
2023-06-06 17:47:03 Type 'q()' to quit R.
2023-06-06 17:47:03 
2023-06-06 17:45:24 Checking rgeos availability: TRUE
2023-06-06 17:45:26 During startup - Warning message:
2023-06-06 17:45:26 replacing previous import ‘shiny::renderDataTable’ by ‘DT::renderDataTable’ when loading ‘reportingGrofwild’ 
2023-06-06 17:45:26 Error: unexpected end of input
2023-06-06 17:45:26 Execution halted
2023-06-06 17:47:04 Checking rgeos availability: TRUE
2023-06-06 17:47:06 During startup - Warning message:
2023-06-06 17:47:06 replacing previous import ‘shiny::renderDataTable’ by ‘DT::renderDataTable’ when loading ‘reportingGrofwild’ 
2023-06-06 17:47:06 Error: unexpected end of input
2023-06-06 17:47:06 Execution halted
2023-06-06 17:47:06 > reportingGrofwild::runWildApp(public
2023-06-06 17:47:06 + 
2023-06-06T15:47:06.737726806Z + 
SanderDevisscher commented 1 year ago

this is the current final line of the dockerfile: CMD ["R", "-e reportingGrofwild::runWildApp(public=FALSE)"]

SanderDevisscher commented 1 year ago

@mvarewyck I found out I needed to add the runWildApp command to the docker run command. The command I tried is: docker run -p 3838:3838 openanalytics/<image name> R -e "Sys.setenv('AWS_DEFAULT_REGION'='eu-west-1', 'AWS_ACCESS_KEY_ID'='<je AWS_ACCESS_KEY_ID>', 'AWS_SECRET_ACCESS_KEY'='<je AWS_SECRET_ACCESS_KEY>');reportingGrofwild::runWildApp(public=FALSE)". however depending on the image I specify I get the following errors:

image used = openanalytics/wildapp :

Unable to find image 'openanalytics/wildapp:latest' locally
docker: Error response from daemon: pull access denied for openanalytics/wildapp, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.

Note I build the docker successfully using docker build -t openanlytics/wildapp . see docker image ls output

REPOSITORY             TAG       IMAGE ID       CREATED       SIZE
openanlytics/wildapp   latest    3213d1562bcb   3 hours ago   2GB

image used = openanalytics/r-base:

Error in loadNamespace(name) :
  there is no package called ‘reportingGrofwild’
Calls: :: ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted

Note I did not build r-base prior to running. It got pulled from the cloud I guess.

mvarewyck commented 1 year ago

@SanderDevisscher Note that there is a typo: your image name is openanlytics/wildapp, not openanalytics/wildapp

SanderDevisscher commented 1 year ago

@SanderDevisscher Note that there is a typo: your image name is openanlytics/wildapp, not openanalytics/wildapp

I see, too bad its not in the actual run command :-(

mvarewyck commented 1 year ago

This should work in your case. Does it?

docker run -p 3838:3838 openanlytics/<image name> R -e "Sys.setenv('AWS_DEFAULT_REGION'='eu-west-1', 'AWS_ACCESS_KEY_ID'='<je AWS_ACCESS_KEY_ID>', 'AWS_SECRET_ACCESS_KEY'='<je AWS_SECRET_ACCESS_KEY>');reportingGrofwild::runWildApp(public=FALSE)"
SanderDevisscher commented 1 year ago

it does thanks