149376 (3) [Avatar] Offline

This might be somewhat on the side of the topic, but I hope it's relevant enough for an answer smilie

Since the 16.04 ubuntu version does not seem to work anymore, I tried moving to 18.10 (and also 18.04). These do not
have apache installed, so I added apache2 to the package list. However, despite -y being specified, the apache2 install
tries to interactively ask me about location/timezones.

What is the proper way to install apache2 using apt, and avoid all interactivity?
MacFlecknoe (22) [Avatar] Offline
You will need to pass DEBIAN_FRONTEND=noninteractive to apt-get:

RUN apt-get update \
    && apt-get upgrade -y \
    && DEBIAN_FRONTEND=noninteractive apt-get install -y \
    apache2 \
    libapache2-mod-php \
    php7.0 \
    php7.0-mysql \
    && rm -rf /var/lib/apt/lists/*
Peter Fisher (8) [Avatar] Offline
Hi all, I would use an argument instead of a environment variable.
Like this:

ARG DEBIAN_FRONTEND=noninteractive

Using an argument will only set the variable when building the image.
Environment variables in Dockerfiles are baked into the Docker image. This may cause issues later on
MacFlecknoe (22) [Avatar] Offline
Thanks Peter. My recommendation was to pass that variable inline to the call which wouldnt set an ENV variable as far as I am aware.

I do like your approach better however as the variable is set for the entire build.