Docker:构建自己的图像问题

时间:2015-07-23 18:18:17

标签: image macos build docker boot2docker

我发现了码头工,我按照官方网站的入门部分进行了操作。 然而,我陷入了“建立你自己的形象”#34;第link节 在步骤2中,当您被要求从docker文件构建新图像时。 我正在使用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) ...

任何已经玩过本教程的人都会有一点暗示。

1 个答案:

答案 0 :(得分:17)

在您调用dpkg-preconfigure之前运行以下行可以解决的apt错误消息:

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

未找到问题是由拼写错误引起的。只需更换

CMD /usr/games/fortunes -a | cowsay

由:

CMD /usr/games/fortune -a | cowsay
相关问题