Docker:构build你自己的图片问题

我正在发现docker工,然后我在官方网站上按照入门部分。 但是,当您被要求从docker文件构build新的图像时,我陷入了步骤2中的“构build自己的图像”部分链接 。 我在OSX Yosemite上工作,我运行的所有东西都来自Boot2Dockerterminal。

以下是教程中的dockerfile:

FROM docker/whalesay:latest RUN apt-get -y update && apt-get install -y fortunes CMD /usr/games/fortunes -a | cowsay 

我build立了形象

 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环境variables未设置为添加行

 ENV TERM [term name] 

解决了这个问题,但是我仍然有dkkg-prconfigure警报。 无论如何,这一切都不会打破build设过程,但是当我执行图像

 docker run docker-whale 

鲸鱼什么也没有说,而是说没有命运的输出(空的领域),因为程序没有被发现

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

我不知道如何解决这个问题,因为在构build过程中,一切似乎都很顺利

 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