zoukankan      html  css  js  c++  java
  • [Docker] 使用ubuntu涉及时区问题

    不多说,以下Dockerfile会报错

    FROM ubuntu:latest
    
    RUN apt-get update && apt-get install -y 
        ssh 
        build-essential 
        gcc 
        g++ 
        gdb 
        clang 
        cmake 
        rsync 
        tar 
        python 
        vim 
        automake 
        openssh-client 
        openssh-server 
      && apt-get clean
    
    RUN PermitRootLogin yes 
      && UsePAM no
    
    RUN passwd root
    
    COPY entrypoint.sh /sbin
    RUN chmod +x /sbin/entrypoint.sh
    ENTRYPOINT [ "/sbin/entrypoint.sh" ]

    会卡在这里

    Preparing to unpack .../tzdata_2018i-0ubuntu0.18.04_all.deb ...
    Unpacking tzdata (2018i-0ubuntu0.18.04) ...
    Setting up tzdata (2018i-0ubuntu0.18.04) ...
    debconf: unable to initialize frontend: Dialog
    debconf: (TERM is not set, so the dialog frontend is not usable.)
    debconf: falling back to frontend: Readline
    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,还是僵死在那里。

    解决方案:加入以下代码

    RUN export DEBIAN_FRONTEND=noninteractive 
        && apt-get update 
        && apt-get install -y tzdata 
        && ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 
        && dpkg-reconfigure --frontend noninteractive tzdata

    Have fun with Docker!

  • 相关阅读:
    图的建立的两种方法(领接矩阵,领接表)
    蛇形填数
    谁买单,猴子选大王等类似题目不同解法!!!
    根据前序中序写后序(正确写法)
    月份牌
    子网掩码
    android 之 surfaceView和普通View的重绘使用
    android 之 Toast通知的使用
    viewSub惰性装载器
    对文件进行加密
  • 原文地址:https://www.cnblogs.com/davidhhuan/p/13223444.html
Copyright © 2011-2022 走看看