** UPDATED QUESTION **
I am running an R Studio server docker container and when login cannot import libraries (e.g. rvest) I installed in R studio with all dependecies installed.
docker-compose.yml
version: '3.9'
services:
rstudio:
build: ./docker/rstudio
container_name: etl
environment:
- PASSWORD=yourpassword
ports:
- 8787:8787
Dockerfile
FROM rocker/rstudio
RUN apt-get clean all && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
python3-pip \
&& apt-get clean all && \
apt-get purge && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN /usr/local/lib/R/bin/R -e 'install.packages("ODBC", repos="https://packagemanager.rstudio.com/cran/__linux__/focal/latest")' && \
/usr/local/lib/R/bin/R -e 'install.packages("RODBC", repos="https://packagemanager.rstudio.com/cran/__linux__/focal/latest")' && \
/usr/local/lib/R/bin/R -e 'install.packages("DBI", repos="https://packagemanager.rstudio.com/cran/__linux__/focal/latest")' && \
/usr/local/lib/R/bin/R -e 'install.packages("rvest", repos="https://packagemanager.rstudio.com/cran/__linux__/focal/latest")'
Error
> library(rvest)
Error: package or namespace load failed for ‘rvest’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/usr/local/lib/R/site-library/xml2/libs/xml2.so':
libxml2.so.2: cannot open shared object file: No such file or directory
The file '/usr/local/lib/R/site-library/xml2/libs/xml2.so' actually exists, but #2 not : '/usr/local/lib/R/site-library/xml2/libs/xml2.so.2'
