rocker/shiny missing library

I'm trying to run my shiny app on shiny-server but it's not working. The app works fine on my local machine.
Below are the steps I have followed:
on the remote computer terminal (Ubuntu 20.04)

$ sudo docker run --rm -p 3838:3838 -v /home/userid/app_folder/:/srv/shiny-server/sample-apps/new_app rocker/shiny

[2021-11-04T09:16:11.848] [INFO] shiny-server - Shiny Server v1.5.18.979 (Node.js v12.22.6)
[2021-11-04T09:16:11.851] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2021-11-04T09:16:11.901] [WARN] shiny-server - Running as root unnecessarily is a security risk! You could be running more securely as non-root.
[2021-11-04T09:16:11.906] [INFO] shiny-server - Starting listener on http://[::]:3838
[2021-11-04T09:16:16.773] [INFO] shiny-server - Created bookmark state directory: /var/lib/shiny-server/bookmarks
[2021-11-04T09:16:16.774] [INFO] shiny-server - Created user bookmark state directory: /var/lib/shiny-server/bookmarks/shiny

on the local browser:

ip-address:3838 gives "Welcome to Shiny Server!"

on remote terminal:

processing file: index.Rmd
output file: /tmp/Rtmpk7wmvg/file13e1e74ec9a/index.knit.md
Output created: /tmp/Rtmpk7wmvg/file13e1e74ec9a/index.html

but when I do this:
ip-address:3838/sample-apps/new_app

An error has occurred!
An error has occurred. Check your logs or contact the app author for clarification.

on the remote server terminal where the docker is running:

Listening on http://127.0.0.1:44947
Warning: Error in library: there is no package called ‘shinyjs’
  79: <Anonymous>
  
*** '/var/log/shiny-server//ewas-shiny-20211104-091653-44947.log' has been deleted ***

library loads fine
$ sudo R

library("shinyjs")

I have installed all the required libraries before running docker and I have tried with my own Dockerfile but nothing is working. Every time I get " An error has occurred! An error has occurred. Check your logs or contact the app author for clarification." and the log file is empty.

I would appreciate if someone can help me identify the problem.

it looks like shinyjs is installed locally and works fine.

The problem that you are facing is that the shiny app is being executed within the docker container rocker/shiny and its only connection to your local PC is the availability of /home/userid/app_folder. So the docker container has no access to your local R installation (and "shinyjs") and hence your app fails to work with shinyjs.

There is various ways out of this but you need to make all the needed R libraries available within the docker container.

You can get a list of available R packages within the container via

docker run -ti rocker/shiny R -q -e "installed.packages()"