簡體   English   中英

Docker:構建自己的圖像問題

[英]Docker: Build your own image issue

我正在發現碼頭,我跟着官方網站的入門部分。 但是,當您被要求從docker文件構建新映像時,我會陷入步驟2中的“構建您自己的映像”部分鏈接 我正在使用OSX Yosemite,我運行的所有內容都來自Boot2Docker終端。

這是教程中的dockerfile:

FROM docker/whalesay:latest

RUN apt-get -y update && apt-get install -y fortunes

CMD /usr/games/fortunes -a | cowsay

我建立了圖像

docker build -t docker-whale .

apt做了它的東西,並在安裝財富時向我顯示以下日志

debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 

這是因為沒有設置TERM環境變量所以添加行

ENV TERM [term name]

解決了這個問題,但我仍然有dkkg-prconfigure警報。 無論如何,所有這些都不會破壞構建過程,但是當我執行圖像時

docker run docker-whale

鯨魚什么也沒說,而不是說財富的輸出(空場),因為找不到程序

/bin/sh: 1: /usr/games/fortunes: not found

我不知道如何解決它,因為在構建期間一切似乎都很好

Selecting previously unselected package fortune-mod.
Preparing to unpack .../fortune-mod_1%3a1.99.1-7_amd64.deb ...
Unpacking fortune-mod (1:1.99.1-7) ...
Selecting previously unselected package fortunes-min.
Preparing to unpack .../fortunes-min_1%3a1.99.1-7_all.deb ...
Unpacking fortunes-min (1:1.99.1-7) ...
Selecting previously unselected package fortunes.
Preparing to unpack .../fortunes_1%3a1.99.1-7_all.deb ...
Unpacking fortunes (1:1.99.1-7) ...
Setting up librecode0:amd64 (3.6-21) ...
Setting up fortune-mod (1:1.99.1-7) ...
Setting up fortunes-min (1:1.99.1-7) ...
Setting up fortunes (1:1.99.1-7) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...

任何已經玩過本教程的人都會有一點暗示。

在調用apt之前,可以通過運行以下行來修復dpkg-preconfigure錯誤消息:

RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

未發現的問題是由拼寫錯誤引起的。 只需更換

CMD /usr/games/fortunes -a | cowsay

通過:

CMD /usr/games/fortune -a | cowsay

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM