I was trying to create a Dockerfile for installing Apache2 on an Ubuntu base image and running Apache2 automatically when the container starts. Here are the instructions I wrote in it:
FROM ubuntu
RUN apt update; \
apt install apache2 -y
EXPOSE 80
CMD [“service”, “apache2”, “start”]
But, while installing, Apache2 is asking for geographic area and time zone and Dockerfile is getting stuck. Can anyone help with this?
CodePudding user response:
Just add the environment variable DEBIAN_FRONTEND=noninteractive
before the command.
FROM ubuntu
RUN apt update; \
DEBIAN_FRONTEND=noninteractive apt install apache2 -y
EXPOSE 80
CMD [“service”, “apache2”, “start”]
check this to learn more https://askubuntu.com/questions/972516/debian-frontend-environment-variable