我正在使用下面的语句在docker中安装R。
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/*它会问一系列问题。首先,它被卡住了,我不知道为什么:
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我回答了以下问题,但什么也没有发生:
Geographic area: 8完整的dockerfile是:
#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"]发布于 2020-11-29 05:57:14
它需要这些信息,这是Debian的一个标准特性。您可以通过关闭交互模式在任何脚本安装中强制覆盖。在通过ENV关键字工作的Dockerfile文件中:
ENV DEBIAN_FRONTEND noninteractive我确实在Rocker Project的几个Dockerfile中使用了它:
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:~$ 顺便说一句,你问题中的Dockerfile看起来是我的直接副本。很高兴看到它被使用了,如果你在你的来源中添加一个评论,可能会更好……
发布于 2020-11-29 05:40:37
手动设置时区配置对我很有效:
ENV TZ=Europe/Moscow
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezonehttps://stackoverflow.com/questions/62299928
复制相似问题