Building a container with Ubuntu 20.04, and got asked to chose the timezone. In my dockerfile I set it to be noninteractive, but it still is asking me for it. Any help would be appreciated.
ENV TZ=US \ DEBIAN_FRONTEND=noninteractive
=> [stage-1 21/28] RUN apt-get update && apt-get install -y nvidia-driver-470 529.9s => => # 1. Africa 6. Asia 11. System V timezones => => # 2. America 7. Atlantic Ocean 12. US => => # 3. Antarctica 8. Europe 13. None of the above => => # 4. Australia 9. Indian Ocean => => # 5. Arctic Ocean 10. Pacific Ocean => => # Geographic area:
Tried: ENV TZ=US \ DEBIAN_FRONTEND=noninteractive
Here is a part of my Dockerfile
FROM freesurfer/freesurfer:7.1.1 as Stage1
ENV TZ=US \
DEBIAN_FRONTEND=noninteractive
ARG DEBIAN_FRONTEND=noninteractive
# Stage 2
FROM deepmi/fastsurfer:gpu-v2.1.1
# Dev install. git for pip editable install.
RUN apt-get update && \
apt-get install -y nvidia-driver-440 && \
apt-get install -y wget && \
apt-get install --no-install-recommends -y apt-utils git && \
apt-get -y install curl && \
apt-get install libgomp1 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Your problem is that you have a multi-stage build. You're only setting the environment in the first stage. At least in your example, you're not actually using anything in the first stage, so you could simplify your Dockerfile to:
FROM deepmi/fastsurfer:gpu-v2.1.1
ENV TZ=US \
DEBIAN_FRONTEND=noninteractive
# Dev install. git for pip editable install.
RUN apt-get update && \
apt-get install -y nvidia-driver-440 && \
apt-get install -y wget && \
apt-get install --no-install-recommends -y apt-utils git && \
apt-get -y install curl && \
apt-get install libgomp1 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
If you actually need multiple build stages, you'll need to add the ENV
directive to each stage:
FROM freesurfer/freesurfer:7.1.1 as Stage1
ENV TZ=US \
DEBIAN_FRONTEND=noninteractive
.
.
.
# Stage 2
FROM deepmi/fastsurfer:gpu-v2.1.1
ENV TZ=US \
DEBIAN_FRONTEND=noninteractive
.
.
.
Unrelated to your question, but running multiple apt-get install
statements is suboptimal, because that means apt-get
has to re-calculate dependencies multiple times. Just install everything at once:
FROM deepmi/fastsurfer:gpu-v2.1.1
ENV TZ=US \
DEBIAN_FRONTEND=noninteractive
# Dev install. git for pip editable install.
RUN apt-get update && \
apt-get install -y \
nvidia-driver-440 \
wget \
curl \
libgomp1 && \
apt-get install --no-install-recommends -y \
apt-utils \
git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Here we still have two apt-get install
command because you're applying --no-install-recommends
to a couple packages. Otherwise I would bundle everything into a single command.