Ketika saya menjalankannya, ia meminta masukan saya. Setelah saya memberikan masukan saya, itu tergantung di sana. Apakah ada yang tahu bagaimana mengatasi masalah ini?
Step 25/25 : RUN apt-get install -y tzdata ---> Running in ee47a1beff84Reading package lists...Building dependency tree...Reading state information...The following NEW packages will be installed: tzdata0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.Need to get 189 kB of archives.After this operation, 3104 kB of additional disk space will be used.Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 tzdata all 2018i-0ubuntu0.18.04 [189 kB]debconf: unable to initialize frontend: Dialogdebconf: (TERM is not set, so the dialog frontend is not usable.)debconf: falling back to frontend: Readlinedebconf: unable to initialize frontend: Readlinedebconf: (This frontend requires a controlling tty.)debconf: falling back to frontend: Teletypedpkg-preconfigure: unable to re-open stdin: Fetched 189 kB in 1s (219 kB/s)Selecting previously unselected package tzdata.(Reading database ... 25194 files and directories currently installed.)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: Dialogdebconf: (TERM is not set, so the dialog frontend is not usable.)debconf: falling back to frontend: ReadlineConfiguring tzdata------------------Please select the geographic area in which you live. Subsequent configurationquestions will narrow this down by presenting a list of cities, representingthe 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. USGeographic area:``
FROM ubuntu:18.04RUN apt-get update && apt-get install -y tzdata# Testing command: Print the date. It will be in the timezone set from the compose file.CMD date
Pastikan jika Anda menggunakan solusi @petertc dan melakukannya apt-get update && apt-get install pada baris yang sama bahwa DEBIAN_FRONTEND Pernyataan adalah setelah the &&:
Kanan:
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" TZ="America/New_York" apt-get install -y tzdata
Salah:
RUN DEBIAN_FRONTEND="noninteractive" TZ="America/New_York" apt-get update && apt-get install -y tzdata
Dari Dockerfile sederhana, ini berfungsi tetapi mungkin memerlukan penyesuaian lebih lanjut (tz adalah 19:25 tetapi 16:25 di dalam docker, idc sekarang karena ini untuk tujuan otomatisasi pada ARM64 Jetson nano)
Unpacking protobuf-compiler (3.0.0-9.1ubuntu1) ...Setting up python-chardet (3.0.4-1) ...Setting up tzdata (2019c-0ubuntu0.18.04) ...Current default time zone: 'Etc/UTC'Local time is now: Wed Apr 22 16:25:17 UTC 2020.Universal Time is now: Wed Apr 22 16:25:17 UTC 2020.Run 'dpkg-reconfigure tzdata' if you wish to change it.Setting up libxss1:arm64 (1:1.2.2-1) ...
Bagi saya, ini berhasil dan saya lebih suka cara ini (dengan cara ini Anda tidak perlu mengatur mode noninteractive):
Tetapkan variabel lingkungan dengan zona waktu Anda, misalnya:ENV TZ=Europe/Madrid
Kemudian, cetak variabel ini ke dalam file dan kemudian tautkan file itu ke file yang akan dibaca oleh proses konfigurasi saat menginstal tzdata:RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
Akhirnya, instal tzdata secara normal: RUN apt-get update && apt-get install -y tzdata
Pada focal 20.04 solusi menggunakan TZ=... dan DEBIAN_FRONTEND=... tidak bekerja lagi. Ini digunakan untuk bekerja sampai bionic 18.04. Cuplikan file docker yang berfungsi untuk focal terlihat seperti:
Setting up locales (2.34-0ubuntu3) ...debconf: unable to initialize frontend: Dialogdebconf: (TERM is not set, so the dialog frontend is not usable.)debconf: falling back to frontend: ReadlineGenerating locales (this might take a while)... de_AT.UTF-8... done ... sv_SE.UTF-8... doneGeneration complete.Setting up libjansson4:amd64 (2.13.1-1.1build2) ...Setting up libsasl2-modules-db:amd64 (2.1.27+dfsg2-2build1) ...Setting up tzdata (2021e-1ubuntu1) ...debconf: unable to initialize frontend: Dialogdebconf: (TERM is not set, so the dialog frontend is not usable.)debconf: falling back to frontend: ReadlineConfiguring tzdata------------------Please select the geographic area in which you live. Subsequent configurationquestions will narrow this down by presenting a list of cities, representingthe time zones in which they are located. 1. Africa 3. Antarctica 5. Arctic 7. Atlantic 9. Indian 11. US 2. America 4. Australia 6. Asia 8. Europe 10. Pacific 12. EtcGeographic area:
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections# And afterwards whatever you like, for example:RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y \--no-install-recommends install ...
yang menghentikan pelaporan debconf pada terminal yang hilang dan juga menghentikan penginstal tzdata dari membuka menu Lokasi selama pembuatan Dockerfile.