skip to Main Content

I am installing R in docker using the following statement.

RUN apt-get update 
    && apt-get install -y --no-install-recommends 
        littler 
        r-cran-littler 
        r-base 
        r-base-dev 
        r-recommended 
        && echo 'options(repos = c(CRAN = "https://cloud.r-project.org/"), download.file.method = "libcurl")' >> /etc/R/Rprofile.site 
        && echo 'source("/etc/R/Rprofile.site")' >> /etc/littler.r 
    && ln -s /usr/share/doc/littler/examples/install.r /usr/local/bin/install.r 
    && ln -s /usr/share/doc/littler/examples/install2.r /usr/local/bin/install2.r 
    && ln -s /usr/share/doc/littler/examples/installGithub.r /usr/local/bin/installGithub.r 
    && ln -s /usr/share/doc/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/*

It ask a set of questions. In the first of all it gets stuck and I don’t know why:

Configuring tzdata
------------------

Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.

  1. Africa      4. Australia  7. Atlantic  10. Pacific  13. Etc
  2. America     5. Arctic     8. Europe    11. SystemV
  3. Antarctica  6. Asia       9. Indian    12. US

I answerthe following but nothing happens:

Geographic area: 8

The full dockerfile is:

#Main docke image
FROM ubuntu
#Los automatically thrown to the I/O strem and not buffered.
ENV PYTHONUNBUFFERED 1
#Set pythonpath (where python search code)
ARG AIRFLOW_VERSION=1.10.9
ARG AIRFLOW_USER_HOME=/usr/local/airflow

ENV AIRFLOW_HOME=${AIRFLOW_USER_HOME}
ENV PYTHONPATH "${PYTHONPATH}:/"
#Allow airflow GPL dependencies
ENV SLUGIFY_USES_TEXT_UNIDECODE=yes




#Install libraries and dependencies
RUN apt-get update && apt-get install -y python3-pip mysql-server vim
RUN apt-get install -y unzip wget
# Set the locale
RUN apt-get clean && apt-get update && apt-get install -y locales
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8


RUN set -ex 
    && buildDeps=' 
        freetds-dev 
        libkrb5-dev 
        libsasl2-dev 
        libssl-dev 
        libffi-dev 
        libpq-dev 
        git 
    '&& apt-get update -yqq 
    && apt-get upgrade -yqq 
    && apt-get install -yqq --no-install-recommends 
        $buildDeps 
        freetds-bin 
        build-essential 
        default-libmysqlclient-dev 
        apt-utils 
        curl 
        rsync 
        netcat 
        locales 
        zip 
    && sed -i 's/^# en_US.UTF-8 UTF-8$/en_US.UTF-8 UTF-8/g' /etc/locale.gen 
    && locale-gen 
    && update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 
    #&& useradd -ms /bin/bash -d ${AIRFLOW_USER_HOME} airflow 
    && pip install -U setuptools wheel
    && pip install pytz 
    && pip install pyOpenSSL 
    && pip install ndg-httpsclient 
    && pip install pyasn1 
    && pip install apache-airflow[crypto,postgres,ssh,s3]==${AIRFLOW_VERSION} 
    && pip install 'redis==3.2' 
    && if [ -n "${PYTHON_DEPS}" ]; then pip install ${PYTHON_DEPS}; fi 
    && apt-get purge --auto-remove -yqq $buildDeps 
    && apt-get autoremove -yqq --purge 
    && apt-get clean 
    && rm -rf 
        /var/lib/apt/lists/* 
        /tmp/* 
        /var/tmp/* 
        /usr/share/man 
        /usr/share/doc 
        /usr/share/doc-base

RUN apt-get update 
    && apt-get install -y --no-install-recommends 
        littler 
        r-cran-littler 
        r-base 
        r-base-dev 
        r-recommended 
        && echo 'options(repos = c(CRAN = "https://cloud.r-project.org/"), download.file.method = "libcurl")' >> /etc/R/Rprofile.site 
        && echo 'source("/etc/R/Rprofile.site")' >> /etc/littler.r 
    && ln -s /usr/share/doc/littler/examples/install.r /usr/local/bin/install.r 
    && ln -s /usr/share/doc/littler/examples/install2.r /usr/local/bin/install2.r 
    && ln -s /usr/share/doc/littler/examples/installGithub.r /usr/local/bin/installGithub.r 
    && ln -s /usr/share/doc/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/*

WORKDIR "/"
ENTRYPOINT ["/entrypoint.sh"]
#arg to entrypoint
CMD ["webserver"]

3

Answers


  1. Setting timezone configs manually worked for me:

    ENV TZ=Europe/Moscow
    RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
    
    Login or Signup to reply.
  2. It’s a standard Debian feature that it wants that information. You can force an override in any scripted installation by turning off interactive mode. In a Dockerfile that works via the ENV keyword:

    ENV DEBIAN_FRONTEND noninteractive
    

    I do use this in a few Dockerfiles of the Rocker Project:

    edd@rob:~$ grep DEBIAN git/rocker/*/Dockerfile git/rocker/*/*/Dockerfile 
    git/rocker/r-devel/Dockerfile:ENV DEBIAN_FRONTEND noninteractive
    git/rocker/r-apt/bionic/Dockerfile:ENV DEBIAN_FRONTEND noninteractive
    git/rocker/r-apt/cosmic/Dockerfile:ENV DEBIAN_FRONTEND noninteractive
    git/rocker/r-apt/disco/Dockerfile:ENV DEBIAN_FRONTEND noninteractive
    git/rocker/r-bspm/bionic/Dockerfile:#ENV DEBIAN_FRONTEND noninteractive
    git/rocker/r-bspm/focal/Dockerfile:#ENV DEBIAN_FRONTEND noninteractive
    git/rocker/r-bspm/testing/Dockerfile:#ENV DEBIAN_FRONTEND noninteractive
    git/rocker/r-rspm/bionic/Dockerfile:ENV DEBIAN_FRONTEND noninteractive
    git/rocker/r-rspm/focal/Dockerfile:ENV DEBIAN_FRONTEND noninteractive
    git/rocker/r-ubuntu/bionic/Dockerfile:ENV DEBIAN_FRONTEND noninteractive
    git/rocker/r-ubuntu/focal/Dockerfile:ENV DEBIAN_FRONTEND noninteractive
    edd@rob:~$ 
    

    BTW looks like the Dockerfile in your question is a straight-up copy of mine. Nice to see it being used, might be even nicer if you put a comment in about where you sourced it from …

    Login or Signup to reply.
  3. ARG DEBIAN_FRONTEND=noninteractive

    worked here too! I was with this issue, trying to install cmake in ubuntu20.04 in docker!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search