The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

149376 (3) [Avatar] Offline
#1
Hi,

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
#2
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
#3
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
#4
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.