11

I've tried several things including

ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Lnndon
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

But whatever I do I get

Configuring tzdata
------------------

Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.

  1. Africa      4. Australia  7. Atlantic  10. Pacific  13. Etc
  2. America     5. Arctic     8. Europe    11. SystemV
  3. Antarctica  6. Asia       9. Indian    12. US
Geographic area:

And user input does not work (I really want this to be non interactive).

Here is the full Dockerfile.

FROM ubuntu:18.04

ENV DEBIAN_FRONTEND=noninteractive

ENV TZ=Europe/Lnndon
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

#install all the system dependencies and enable PHP modules 
RUN apt-get update && apt-get install -yq --no-install-recommends \
    apt-utils \
    curl \
    # Install git
    git \
    # Install apache
    apache2 \
    # Install php 7.2
    libapache2-mod-php7.2 \
    php7.2-cli \
    php7.2-json \
    php7.2-curl \
    php7.2-fpm \
    php7.2-gd \
    php7.2-ldap \
    php7.2-mbstring \
    php7.2-mysql \
    php7.2-soap \
    php7.2-sqlite3 \
    php7.2-xml \
    php7.2-zip \
    php7.2-intl \
    php-imagick \
    # Install tools
    openssl \
    nano \
    graphicsmagick \
    imagemagick \
    ghostscript \
    mysql-client \
    iputils-ping \
    locales \
    sqlite3 \
    ca-certificates \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

#set our application folder as an environment variable
ENV APP_HOME /var/www/html

#change uid and gid of apache to docker user uid/gid
RUN usermod -u 1000 www-data && groupmod -g 1000 www-data

#change the web_root to laravel /var/www/html/public folder
RUN sed -i -e "s/html/html\/public/g" /etc/apache2/sites-enabled/000-default.conf

# enable apache module rewrite
RUN a2enmod rewrite

#copy source files and run composer
COPY . $APP_HOME

# install all PHP dependencies
RUN composer install --no-interaction

#change ownership of our applications
RUN chown -R www-data:www-data $APP_HOME

Any idea how to fix this?

Ben Edwards
  • 301
  • 3
  • 12
  • 1
    I was unable to reproduce your issue, but maybe the packages have updated between your run and mine. However one can not help but spot that you have a type-o in London ( TZ=Europe/Lndon), you seem to be missing an o. – Petter H May 23 '20 at 12:25
  • I couldn't reproduce it either, install ran to step 12/13 and failed on the composer install since my copy did not include any files. – BMitch May 23 '20 at 18:04

2 Answers2

5

This worked for me. This is the Dockerfile:

FROM ubuntu:20.04

RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends git cmake g++

# Cleanup
RUN  apt-get clean && \
  rm -rf /var/lib/apt

The packages git, cmake and g++ are the ones I needed in the image. Replace that with what you need.

gmoreno
  • 59
  • 1
  • 2
0

Instead of setting timezone as fixed inside the image, I would recommend passing it from environment variables.

Dockerfile:

FROM ubuntu

RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y tzdata 

commandline:

docker run -it -e TZ=America/New_York <IMAGE> date
Daniel K
  • 633
  • 1
  • 4
  • 15
ShinChven
  • 101
  • 1
  • this didn't work though, I had to give `DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC sudo apt-get install -y` – Surya May 20 '22 at 12:47