Docker:建立自己的形象问题
Docker: Build your own image issue
我正在探索 docker 并且我遵循了官方网站中的入门部分。
但是我陷入了 "Build your own image" 部分 link
在第 2 步中,当您被要求从 docker 文件构建新图像时。
我正在 OSX Yosemite 工作,我 运行 的所有内容都来自 Boot2Docker 终端。
这是教程中的 docker 文件:
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 完成它的工作并在安装 fortunes 时向我显示以下日志
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
鲸鱼什么也没说,而不是说 fortunes 的输出(空字段),因为找不到程序
/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
我正在探索 docker 并且我遵循了官方网站中的入门部分。 但是我陷入了 "Build your own image" 部分 link 在第 2 步中,当您被要求从 docker 文件构建新图像时。 我正在 OSX Yosemite 工作,我 运行 的所有内容都来自 Boot2Docker 终端。
这是教程中的 docker 文件:
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 完成它的工作并在安装 fortunes 时向我显示以下日志
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
鲸鱼什么也没说,而不是说 fortunes 的输出(空字段),因为找不到程序
/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