8

I am trying to create a docker image with base image as Ubuntu, NodeJS, Git & Google chrome.

This is my dockerfile.

FROM ubuntu:20.04

USER root

WORKDIR /home/app

COPY ./package.json /home/app/package.json

RUN apt-get update

RUN apt-get -y install curl gnupg

RUN apt-get install g++ build-essential --yes

RUN curl -sL https://deb.nodesource.com/setup_15.x  | bash -

RUN apt-get -y install nodejs

RUN apt-get install git --yes

# Install Google Chrome
RUN apt-get install wget
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get install ./google-chrome*.deb --yes

When I build the image, I keep getting stuck the this step.

 => [12/13] RUN apt-get install ./google-chrome*.deb --yes                                                                                                                                409.6s
 => => #   1. Africa        6. Asia            11. System V timezones                                                                                                                           
 => => #   2. America       7. Atlantic Ocean  12. US                                                                                                                                           
 => => #   3. Antarctica    8. Europe          13. None of the above                                                                                                                            
 => => #   4. Australia     9. Indian Ocean                                                                                                                                                     
 => => #   5. Arctic Ocean  10. Pacific Ocean                                                                                                                                                   
 => => # Geographic area:

Has anyone had a similar experience and was able to resolve this.

hifzur
  • 193
  • 3
  • 10

2 Answers2

5

I solved that issue by configuring the timezone before installing Chrome

ENV TZ=Europe/Madrid 
RUN echo "Preparing geographic area ..."
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
Paul Verest
  • 60,022
  • 51
  • 208
  • 332
rizome
  • 66
  • 2
  • 5
3

I have finally gotten some clarity on this issue and can provide a work-around for anyone who runs into this issue in the future.

Problem: The geographical area will be requested within the standard ubuntu 20.04 image from Docker because that image has been stripped of the locale settings. Those settings can usually be found by using locale or localectl status in the terminal; however, both of those commands require the presence of the systemd service (which is not included with the standard ubuntu 20.04 image you are using in your FROM statement). In addition to this, you will not be able to easily add systemd to that image as you'll run into an issue with it not being PID1 during start of your docker container.

Solution: The easiest solution I found is to simply change to using an Ubuntu image that already contains systemd. One such image that I am using now is jrei/systemd-ubuntu. So what you could do to prevent that question for region selection on Chrome or any other app that may request it is to replace your current FROM statement with this one: FROM jrei/systemd-ubuntu:20.04.

Ryan Harris
  • 329
  • 2
  • 9