Avoiding user interaction with tzdata when installing certbot in a docker container

Solution 1:

To run dpkg (behind other tools like Apt) without interactive dialogue, you can set one environment variable as

DEBIAN_FRONTEND=noninteractive

For example, you can set it in Dockerfile using ARG:

ARG DEBIAN_FRONTEND=noninteractive

Solution 2:

On Ubuntu 18.04 I did that Dockerfile:

ENV TZ=Europe/Minsk
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && apt instal....

Solution 3:

TL&DR: Within your DockerFile

ENV DEBIAN_FRONTEND=noninteractive 

Reason:

Certain Installers make 'installations' easier by having a nice front-end. While this is great when you have a manual install, this becomes an issue during automated installations.

You can over ride the interactive installation by placing the following in your environment string.

Cheers

Solution 4:

You can set DEBIAN_FRONTEND=noninteractive before your command to avoid ENV DEBIAN_FRONTEND=noninteractive affects commands after or child image:

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        tzdata \
    && rm -rf /var/lib/apt/lists/*