zesla
zesla

Reputation: 11793

shiny docker image build failed due to ubuntu package issue

I'm trying to build docker image for my R shiny app. Below is theDockerfile.

# Install R version 3.6
FROM r-base:3.6.0

# Install Ubuntu packages
RUN apt-get update && apt-get install -y \
    sudo \
    gdebi-core \
    pandoc \
    pandoc-citeproc \
    libcurl4-gnutls-dev \
    libcairo2-dev \
    libxt-dev \
    xtail \
    wget \
    libudunits2-dev \
    libgdal-dev

# Install R packages that are required
RUN R -e "install.packages(c('remotes', 'tidyr', 'dplyr', 'ggplot2', 'stringr','shiny', 'shinydashboard','shinyWidgets','shinyjs', 'rlang','scales','DT','lubridate', 'plotly',  'leaflet', 'leafpop', 'visNetwork', 'wordcloud2', 'arules'), repos='http://cran.rstudio.com/')"
RUN R -e "remotes::install_github('nik01010/dashboardthemes')"

# Download and install ShinyServer (latest version)
RUN wget --no-verbose https://download3.rstudio.org/ubuntu-14.04/x86_64/VERSION -O "version.txt" && \
    VERSION=$(cat version.txt)  && \
    wget --no-verbose "https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-$VERSION-amd64.deb" -O ss-latest.deb && \
    gdebi -n ss-latest.deb && \
    rm -f version.txt ss-latest.deb

# Copy configuration files into the Docker image
COPY shiny-server.conf  /etc/shiny-server/shiny-server.conf
COPY /app /srv/shiny-server/

# Make the ShinyApp available at port 80
EXPOSE 80

# Copy further configuration files into the Docker image
COPY shiny-server.sh /usr/bin/shiny-server.sh

CMD ["/usr/bin/shiny-server.sh"]

However, my image building failed quite early. Below is all the logs. It seems like some Ubuntu package issue which I do not quite understand.

I'm new to docker. I have not clue what to do with those error messages. Appreciate if anyone can help find out what needs to be done. Thanks.

Sending build context to Docker daemon  113.4MB
Step 1/10 : FROM r-base:3.6.0
 ---> 876f4d7b60e9
Step 2/10 : RUN apt-get update && apt-get install -y     sudo     gdebi-core     pandoc     pandoc-citeproc     libcurl4-gnutls-dev     libcairo2-dev     libxt-dev     xtail     wget  libudunits2-dev      libgdal-dev
 ---> Running in 825a69c5a05f
Get:2 http://deb.debian.org/debian testing InRelease [116 kB]
Get:1 http://cdn-fastly.deb.debian.org/debian sid InRelease [146 kB]
Get:3 http://deb.debian.org/debian testing/main amd64 Packages [7,690 kB]
Get:4 http://cdn-fastly.deb.debian.org/debian sid/main amd64 Packages [8,225 kB]
Fetched 16.2 MB in 6s (2,724 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libc6-dev : Breaks: libgcc-8-dev (< 8.4.0-2~) but 8.3.0-7 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
The command '/bin/sh -c apt-get update && apt-get install -y     sudo     gdebi-core     pandoc     pandoc-citeproc     libcurl4-gnutls-dev     libcairo2-dev     libxt-dev     xtail     wget       libudunits2-dev         libgdal-dev' returned a non-zero code: 100

Upvotes: 1

Views: 587

Answers (1)

clemens
clemens

Reputation: 6813

The error message you are receiving is not Docker specific, but rather concerns your package manager apt.

Although you are updating the package list using apt-get update, you do not install newer versions of packages. What happens now is that you are trying to install a newer version of an already installed package which leads to the error message.

If you use apt-get upgrade, apt will install the newer versions of your installed packages.

Changing the 5th line as shown below will fix that issue:

RUN apt-get update && apt-get upgrade -y && apt-get install -y \

Upvotes: 3

Related Questions