I need to install r-base within an ubuntu:18.04 dockerimage. I am doing this while building my image via
RUN apt-get update; apt-get install -y r-base [many other packages]
along with many other package installations. The problem is, that while setting up r-base at the end of the installation process, it asks for user input for timezone followed by city within the specified timezone. I obviously cannot enter the data while building the container. How would I manage to install r-base anyways?
From AskUbuntu, you should set
ENV DEBIAN_FRONTEND=noninteractive
Directly taken from: https://github.com/rocker-org/rocker/blob/master/r-ubuntu/Dockerfile
FROM ubuntu:bionic
LABEL org.label-schema.license="GPL-2.0" \
org.label-schema.vcs-url="https://github.com/rocker-org/r-apt" \
org.label-schema.vendor="Rocker Project" \
maintainer="Dirk Eddelbuettel <edd#debian.org>"
## Set a default user. Available via runtime flag `--user docker`
## Add user to 'staff' group, granting them write privileges to /usr/local/lib/R/site.library
## User should also have & own a home directory (for rstudio or linked volumes to work properly).
RUN useradd docker \
&& mkdir /home/docker \
&& chown docker:docker /home/docker \
&& addgroup docker staff
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
software-properties-common \
ed \
less \
locales \
vim-tiny \
wget \
ca-certificates \
&& add-apt-repository --enable-source --yes "ppa:marutter/rrutter3.5" \
&& add-apt-repository --enable-source --yes "ppa:marutter/c2d4u3.5"
## Configure default locale, see https://github.com/rocker-org/rocker/issues/19
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen en_US.utf8 \
&& /usr/sbin/update-locale LANG=en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
## This was not needed before but we need it now
ENV DEBIAN_FRONTEND noninteractive
# Now install R and littler, and create a link for littler in /usr/local/bin
# Default CRAN repo is now set by R itself, and littler knows about it too
# r-cran-docopt is not currently in c2d4u so we install from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
littler \
r-base \
r-base-dev \
r-recommended \
&& ln -s /usr/lib/R/site-library/littler/examples/install.r /usr/local/bin/install.r \
&& ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \
&& ln -s /usr/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
&& ln -s /usr/lib/R/site-library/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
&& install.r docopt \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
&& rm -rf /var/lib/apt/lists/*
CMD ["bash"]
Related
I have a docker image with RStudio installed.
My flexdashboard app has a section to download a flextable
save_path = str_c(image_dir, "IX_overviewp2_", sub('-','_',current_quarter), ".png")
save_as_image(ft,
path = save_path,
zoom = 3 ,
webshot = "webshot2") # save flextable as png
but when I get to the section of the code, I receive the error: "google-chrome" and "chromium-browser" were not found. Try setting the CHROMOTE_CHROME environment variable or adding one of these executables to your PATH. Error in initialize(...) : Invalid path to Chrome
I updated my docker image to include chrome with the last two RUN commands of my dockerfile, but this still does not solve my issue.
Does anyone have any suggestions?
FROM rocker/verse
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends build-essential libpq-dev python3.8 python3-pip python3-setuptools python3-dev
RUN pip3 install --upgrade pip
ADD . ./home/rstudio
ADD requirements.txt .
ADD install_packages.r .
# Miniconda and dependencies
RUN cd /tmp/ && \
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda3 && \
/root/miniconda3/condabin/conda install -y python=3.7
ENV PATH=$PATH:/root/miniconda3/bin
#RUN npm install phantomjs-prebuilt --phantomjs_cdnurl=http://cnpmjs.org/downloads
# installing python libraries
RUN pip3 install -r requirements.txt
# installing r libraries
RUN Rscript install_packages.r
RUN if ! [[ "16.04 18.04 20.04 21.04 21.10" == *"$(lsb_release -rs)"* ]]; \
then \
echo "Ubuntu $(lsb_release -rs) is not currently supported."; \
exit; \
fi
RUN sudo su
RUN apt-get update && apt-get install -y gnupg2
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN exit
RUN sudo apt-get update
RUN sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17
RUN chmod -R 777 /home/rstudio
# Install Chrome WebDriver
RUN CHROMEDRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` && \
mkdir -p /opt/chromedriver-$CHROMEDRIVER_VERSION && \
curl -sS -o /tmp/chromedriver_linux64.zip http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip && \
unzip -qq /tmp/chromedriver_linux64.zip -d /opt/chromedriver-$CHROMEDRIVER_VERSION && \
rm /tmp/chromedriver_linux64.zip && \
chmod +x /opt/chromedriver-$CHROMEDRIVER_VERSION/chromedriver && \
ln -fs /opt/chromedriver-$CHROMEDRIVER_VERSION/chromedriver /usr/local/bin/chromedriver
# Install Google Chrome
RUN curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list && \
apt-get -yqq update && \
apt-get -yqq install google-chrome-stable && \
rm -rf /var/lib/apt/lists/*
Try adding in you dockerfile:
RUN wget https://downloads.vivaldi.com/stable/vivaldi-stable_5.5.2805.35-1_amd64.deb
RUN apt-get update && apt-get install -y ./vivaldi-stable_5.5.2805.35-1_amd64.deb && rm -rf /var/lib/apt/lists/*
RUN echo CHROMOTE_CHROME=/usr/bin/vivaldi >> .Renviron
I've seen a few other posts about the same issue, but no clear solution from any of them.
When running docker build -t test-shiny ., I get the following error when running the docker image locally:
Error in library(leaflet) : there is no package called ‘leaflet’
Calls: <Anonymous> ... sourceUTF8 -> eval -> eval -> ..stacktraceon.. -> library
Execution halted
Here is my Dockerfile:
# Base image https://hub.docker.com/u/rocker/
FROM rocker/r-base:latest
RUN apt-get update && apt-get -y --no-install-recommends install \
curl \
wget \
sudo \
alien \
redis-server \
gnupg \
unixodbc-dev && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
RUN apt-get update && apt-get -y --no-install-recommends install \
libpng-dev \
libudunits2-dev \
libgeos-dev \
libproj-dev \
libssl-dev \
libcurl4-openssl-dev \
libhiredis-dev \
libmagick++-dev && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean \
libgdal-dev \
netcdf-bin
# Athena ODBC Drivers
RUN wget https://s3.amazonaws.com/athena-downloads/drivers/ODBC/SimbaAthenaODBC_1.1.9.1001/Linux/simbaathena-1.1.9.1001-1.el7.x86_64.rpm && \
sudo alien -i simbaathena-1.1.9.1001-1.el7.x86_64.rpm && \
rm simbaathena-1.1.9.1001-1.el7.x86_64.rpm
# Dependencies
RUN Rscript -e 'install.packages(c("shiny", "shinydashboard", "ggplot2", "patchwork","dbplyr", "dbplot", "scales", "shinycssloaders", "rJava", "RJDBC", "shinyjs", "shinyBS", "highcharter", "leaflet", "DT", "glue", "DBI", "odbc", "data.table"), dependencies = TRUE, repos="http://cran.rstudio.com/", Ncpus=5)' && rm -rf /tmp/downloaded_packages
# Copy App
RUN mkdir shiny-app
COPY evaluation-app/ /shiny-app
# RShiny Port
EXPOSE 3838
# Run App
CMD ["R", "-e", "shiny::runApp('/shiny-app', host = '0.0.0.0', port = 3838)"]
I know I am installing a lot of r packages, but my app runs fine in RStudio. After reading this post, I already tried adding the solution from the accepted answer, but unsuccessful. Any suggestions or solutions would be much appreciated.
I am getting this error while making an image through docker on lambda.
** [ERROR] OSError: cannot load library '/usr/local/lib64/R/lib/libR.so': /usr/local/lib64/R/lib/libR.so: cannot open shared object file: No such file or directory**
Docker file:
FROM public.ecr.aws/lts/ubuntu:latest
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y wget
RUN apt-get install -y software-properties-common
RUN apt-get install -y gcc gfortran build-essential
RUN apt-get update
RUN apt-get install -y libcurl4-openssl-dev
RUN apt-get install -y zlib1g zlib1g-dev libbz2-dev liblzma-dev libpcre++-dev libpango1.0-dev \
xorg-dev \
libreadline-dev
RUN wget -c https://cran.r-project.org/src/base/R-3/R-3.5.0.tar.gz && tar -xf R-3.5.0.tar.gz
RUN cd R-3.5.0 && ./configure --with-readline=no --with-x=no && make && make install
RUN R -e "install.packages('remotes', repos = 'http://cran.us.r-project.org')"
RUN R -e "require(remotes)"
RUN R -e "remotes::install_version('text2vec', version = '0.5.1', repos = 'http://cran.us.r-project.org')"
RUN export LD_LIBRARY_PATH="/usr/local/lib64:$LD_LIBRARY_PATH"
COPY requirements.txt ./
RUN apt-get update && apt-get install -y \
python3.8 \
python3-pip
RUN pip3 install -r requirements.txt
RUN pip3 install \
awslambdaric
RUN ln -s /usr/lib64/R/lib/* /usr/local/lib64/R/lib/
COPY lambda_function.py ./
ENTRYPOINT [ "/usr/bin/python3", "-m", "awslambdaric" ]
CMD ["lambda_function.lambda_handler"]
Any help would be appreciated!
I cleaned up the first parts of your Dockerfile as
FROM public.ecr.aws/lts/ubuntu:latest
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
wget \
software-properties-common \
gcc gfortran build-essential \
libcurl4-openssl-dev \
zlib1g zlib1g-dev libbz2-dev liblzma-dev libpcre++-dev libpango1.0-dev \
xorg-dev \
libreadline-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN wget -c https://cran.r-project.org/src/base/R-3/R-3.5.0.tar.gz && \
tar -xf R-3.5.0.tar.gz && \
cd R-3.5.0 && \
./configure --with-readline=no --with-x=no --enable-R-shlib && \
make -j && make install
Putting all the apt-get into one RUN allows one to clean up by removing apt cache files. Using make -j builds R in parallel, which can speed up the build significantly.
I then built it, and launched the resulting image using bash to see that libR.so did indeed exist.
$ docker build .
...
Successfully built f1d83e97e8ef
$ docker run -it --rm f1d83e97e8ef bash
root#add29666d5d5:/# ls -l /usr/local/lib64/R/lib
total 21984
-rwxr-xr-x 1 root root 16815248 Sep 5 14:43 libR.so
-rwxr-xr-x 1 root root 462896 Sep 5 14:43 libRblas.so
-rwxr-xr-x 1 root root 5226296 Sep 5 14:43 libRlapack.so
libR.so exists and permissions (read and execute for all) are appropriate.
I don't think exporting LD_LIBRARY_PATH or creating a symbolic link should be necessary.
I'm trying to install an old version of RODBC into my dockerfile (I'm using R 3.6.3 and the newest version of RODBC needs R v4) by downloading the package using curl and then installing using install.packages but I'm getting the below error. Any ideas of how to achieve this?
Error: unexpected symbol in "install.packages(RODBC_1.2-6.tar.gz"
In the dockerfile I try to do the above with the following RUN statements:
RUN curl https://cran.r-project.org/src/contrib/Archive/RODBC --output RODBC_1.2-6.tar.gz
RUN R -e "install.packages(RODBC_1.2-6.tar.gz)"
The full dockerfile is:
FROM ubuntu:bionic
RUN useradd docker \
&& mkdir /home/docker \
&& chown docker:docker /home/docker \
&& addgroup docker staff
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
software-properties-common \
ed \
less \
locales \
vim-tiny \
wget \
ca-certificates \
&& add-apt-repository --enable-source --yes "ppa:marutter/rrutter3.5" \
&& add-apt-repository --enable-source --yes "ppa:marutter/c2d4u3.5"
## Configure default locale, see https://github.com/rocker-org/rocker/issues/19
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen en_US.utf8 \
&& /usr/sbin/update-locale LANG=en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
littler \
r-base \
r-base-dev \
r-recommended \
&& ln -s /usr/lib/R/site-library/littler/examples/install.r /usr/local/bin/install.r \
&& ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \
&& ln -s /usr/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
&& ln -s /usr/lib/R/site-library/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
&& install.r docopt \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update
#These are all required, the exact version, for SQL Server to work
RUN apt-get install -y gnupg2 libssl1.0 libssl1.0-dev apt-transport-https
RUN apt-get install -y libcurl4-openssl-dev curl
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql17 unixodbc unixodbc-dev
RUN apt-get install -y libssl-dev
RUN install.r tidyr bigrquery dplyr sqldf readr httr uuid
RUN curl https://cran.r-project.org/src/contrib/Archive/RODBC --output RODBC_1.2-6.tar.gz
RUN R -e "install.packages(RODBC_1.2-6.tar.gz)"
COPY src/upload_v2.r /usr/local/src/scripts/upload_v2.r
WORKDIR /usr/local/src/scripts
It looks like quote is missing in RUN R line:
RUN curl https://cran.r-project.org/src/contrib/Archive/RODBC --output RODBC_1.2-6.tar.gz
RUN R -e "install.packages('RODBC_1.2-6.tar.gz')"
I want to build alticelabs/nginx-log-zmq with openresty.
My commands look exactly like the instructions:
./configure --add-module=../nginx-log-zmq-master
make
make install
However, when running nginx with any zmq directive like log_zmq_server, nginx aborts on start:
$ /usr/local/openresty/bin/openresty
> 2018/11/03 21:06:06 [emerg] 1#0: unknown directive "log_zmq_server" in /usr/local/openresty/nginx/conf/nginx.conf:13
I am sure that the compiling itself works, because the logs show that it was compiled correctly, and it reported an error before because of missing dependencies (libzmq3-dev):
adding module in /openresty-1.13.6.1/../nginx-log-zmq-master
checking for ZeroMQ library ... found
+ ngx_http_log_zmq_module was configured
[...]
The full log output is available at https://paste.ee/p/BCdf6.
My dockerfile:
FROM ubuntu:xenial
RUN apt-get -y update \
&& apt-get -y upgrade \
&& apt-get install -y \
libpcre3 \
libpcre3-dev \
libssl-dev \
libperl4-corelibs-perl \
libzmq3-dev \
g++ \
cmake \
unzip \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN wget https://github.com/openresty/openresty/releases/download/v1.13.6.1/openresty-1.13.6.1.tar.gz \
&& wget https://github.com/alticelabs/nginx-log-zmq/archive/master.zip \
&& unzip master.zip \
&& rm master.zip \
&& tar -xvf openresty-1.13.6.1.tar.gz \
&& rm openresty-1.13.6.1.tar.gz \
&& cd openresty-1.13.6.1/ \
&& ./configure --add-module=../nginx-log-zmq-master -j2 \
&& make -j2 \
&& make install \
&& cd .. \
&& rm -r openresty-1.13.6.1 \
&& rm -r nginx-log-zmq-master
# connect stdout & stderr
RUN ln -sf /dev/stdout /usr/local/openresty/nginx/logs/access.log \
&& ln -sf /dev/stderr /usr/local/openresty/nginx/logs/error.log
COPY cmd.sh /usr/bin/cmd.sh
RUN chmod +x /usr/bin/cmd.sh
# copy configs
COPY *.conf /usr/local/openresty/nginx/conf/
COPY *.lua /usr/local/openresty/nginx/lua/
CMD ["/usr/local/openresty/bin/openresty", "-g", "daemon off;"]