Score:0

Trying to build a Docker Image from Ubuntu 18.04 base image but gets stuck at "Configuring tzdata"

li flag

I'm trying to build a docker image from the following dockerfile:

FROM ubuntu:18.04

# Install Python
RUN apt-get update && apt-get install -y python3.10 python3-pip

# Install Java
RUN apt-get update && apt-get install -y openjdk-8-jdk

# Install Bowtie2
RUN apt-get update && apt-get install -y bowtie2

RUN apt-get update && \
apt-get install --yes --no-install-recommends \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
&& rm -rf /var/lib/apt/lists/*

# Install RSeQC
RUN apt-get update && apt-get install -y python-pip
RUN pip install RSeQC

# Install biopython=1.80
RUN pip install biopython

# Install Atria
RUN apt-get update && apt-get install -y wget
RUN wget https://github.com/cihga39871/Atria/releases/download/v3.1.2/atria-3.1.2-linux.tar.gz
RUN tar -zxf atria-3.1.2-linux.tar.gz
RUN mv atria-3.1.2/bin/atria /usr/local/bin/atria
RUN chmod +x /usr/local/bin/atria

##Atria dependencies
RUN apt-get update && apt-get install pigz pbzip2

# Install findtail
RUN apt-get update && apt-get install -y wget
RUN wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/findtail/findtail_v1.01
RUN mv findtail_v1.01 /usr/local/bin/findtail_v1.01
RUN chmod +x /usr/local/bin/findtail_v1.01

When I try to build the image, it gets stuck at:

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: 6

It remains stuck there forever until I ctrl+c. Any idea why this is happening?

Score:1
uy flag

You need to modify your Dockerfile slightly. An apt update needs to be done once at the beginning. Tzdata is installed as a dependency and configuration does not work. Use the line

RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata. 

You need to adopt the timezone.

Finally your dockerfile may look like:


FROM ubuntu:20.04

# Install tzdata
RUN apt-get update &&\
    DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata

# Install Python, Bowtie2 and Java
RUN apt-get install -y python3.10 python3-pip \ 
    openjdk-8-jdk  \ 
    bowtie2 \ 
    wget

RUN  apt-get install --yes --no-install-recommends \
     zlib1g-dev \
     libbz2-dev \
     liblzma-dev  

# Install RSeQC
RUN pip install RSeQC

# Install biopython=1.80
RUN pip install biopython

# Install Atria
RUN wget https://github.com/cihga39871/Atria/releases/download/v3.1.2/atria-3.1.2-linux.tar.gz && \
    tar -zxf atria-3.1.2-linux.tar.gz && \
    mv atria-3.1.2/bin/atria /usr/local/bin/atria && \
    chmod +x /usr/local/bin/atria

#Atria dependencies
RUN  apt-get install pigz pbzip2

# Install findtail
 RUN wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/findtail/findtail_v1.01 && \
     mv findtail_v1.01 /usr/local/bin/findtail_v1.01 && \
     chmod +x /usr/local/bin/findtail_v1.01 
# Cleanup 
RUN apt clean

and credit goes to how-to-install-tzdata-on-a-ubuntu-docker-image

pubsurfted avatar
li flag
Thank you so much! @dummyuser
dummyuser avatar
uy flag
there seems to be another issue with `RUN pip install biopython` and pyton versions. out of scope of this question.
pubsurfted avatar
li flag
Yeah i just encountered that issue and made a post about it. Where is the error coming from?
dummyuser avatar
uy flag
the python version in ubuntu 18.04 seems to be too old. why do you use 18.04 ?
pubsurfted avatar
li flag
Corrected and it worked. Thank you.
dummyuser avatar
uy flag
I edited my resonse. 1) line 1 use `20.04` and 2) Line 19: `python-pip` is not needed - removed. docker build works.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.