无法启动和运行 docker 图像
trouble getting docker image up and runnig
我昨天下载了 hopsoft/graphite-statsd docker 图片。
当我现在转到 docker 终端并输入 docker images
时,我得到:
bash-3.2$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
hello-world latest af340544ed62 2 weeks ago 960 B
<none> <none> 89bd20e2deb3 3 weeks ago 785.7 MB
bash-3.2$
我猜 hopsoft/graphite-statsd
就是标有 <none>
的那个
但是当我打开 Kitematic(docker 的 GUI)时,我的图像列表中只列出了 hello-world。 hopsoft/graphite-statsd
未列出。
在转到终端并尝试将图像 运行 为:docker run 89bd20e2deb3
,我得到以下信息:
bash-3.2$ docker run 89bd20e2deb3
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
No SSH host key available. Generating one...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
Creating SSH2 ED25519 key; this may take some time ...
invoke-rc.d: policy-rc.d denied execution of restart.
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 94
它就挂在那里。
所以,我决定删除它,然后重新下载。
但是,在 运行 宁 docker rmi 89bd20e2deb3
,我得到以下信息:
bash-3.2$ docker rmi 89bd20e2deb3
Error response from daemon: Conflict, cannot delete because 89bd20e2deb3 is held by an ongoing pull or build
Error: failed to remove images: [89bd20e2deb3]
bash-3.2$
现在,我 docker-tricks
出门了 :)。如何在我的机器上启动并 运行ning 这张图片?我真的需要我能得到的所有帮助。
顺便说一句(这是部分答案),当您看到:
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 94
不是"just hanging"。容器已启动 runit
,一个与 init
或 systemd
非常相似的进程主管,它可能随后在容器内启动了其他进程。你可以看到它们在做类似的事情:
pstree -p $(docker inspect --format '{{.State.Pid}}' <container_id>)
现在,由于 89bd20e2deb3 是一个中间图像(可能是您尝试拉取的石墨图像使用的层),runit
完全有可能实际上没有开始任何其他操作。
这里的关键点是,当您 docker run
图片时,您不一定会得到某种交互式提示。容器可能会启动网络可访问服务(例如 ssh 服务器或 Web 服务器),您可能需要使用该机制与容器进行交互。
根据 documentation for hopsoft/graphite-stats,该图像似乎属于这种情况。文档提供了服务正在侦听的端口列表。
但是您未能成功拉取镜像。问题的线索可能会在您的 docker 守护进程日志中找到...而在哪里可以找到这些线索取决于您的发行版。在 systemd
世界中,答案是 journalctl -b -u docker
。在遗留环境中,可以在系统日志放置它们的任何地方找到日志(可能 /var/log/messages
或类似的)。
我昨天下载了 hopsoft/graphite-statsd docker 图片。
当我现在转到 docker 终端并输入 docker images
时,我得到:
bash-3.2$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
hello-world latest af340544ed62 2 weeks ago 960 B
<none> <none> 89bd20e2deb3 3 weeks ago 785.7 MB
bash-3.2$
我猜 hopsoft/graphite-statsd
就是标有 <none>
但是当我打开 Kitematic(docker 的 GUI)时,我的图像列表中只列出了 hello-world。 hopsoft/graphite-statsd
未列出。
在转到终端并尝试将图像 运行 为:docker run 89bd20e2deb3
,我得到以下信息:
bash-3.2$ docker run 89bd20e2deb3
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
No SSH host key available. Generating one...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
Creating SSH2 ED25519 key; this may take some time ...
invoke-rc.d: policy-rc.d denied execution of restart.
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 94
它就挂在那里。
所以,我决定删除它,然后重新下载。
但是,在 运行 宁 docker rmi 89bd20e2deb3
,我得到以下信息:
bash-3.2$ docker rmi 89bd20e2deb3
Error response from daemon: Conflict, cannot delete because 89bd20e2deb3 is held by an ongoing pull or build
Error: failed to remove images: [89bd20e2deb3]
bash-3.2$
现在,我 docker-tricks
出门了 :)。如何在我的机器上启动并 运行ning 这张图片?我真的需要我能得到的所有帮助。
顺便说一句(这是部分答案),当您看到:
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 94
不是"just hanging"。容器已启动 runit
,一个与 init
或 systemd
非常相似的进程主管,它可能随后在容器内启动了其他进程。你可以看到它们在做类似的事情:
pstree -p $(docker inspect --format '{{.State.Pid}}' <container_id>)
现在,由于 89bd20e2deb3 是一个中间图像(可能是您尝试拉取的石墨图像使用的层),runit
完全有可能实际上没有开始任何其他操作。
这里的关键点是,当您 docker run
图片时,您不一定会得到某种交互式提示。容器可能会启动网络可访问服务(例如 ssh 服务器或 Web 服务器),您可能需要使用该机制与容器进行交互。
根据 documentation for hopsoft/graphite-stats,该图像似乎属于这种情况。文档提供了服务正在侦听的端口列表。
但是您未能成功拉取镜像。问题的线索可能会在您的 docker 守护进程日志中找到...而在哪里可以找到这些线索取决于您的发行版。在 systemd
世界中,答案是 journalctl -b -u docker
。在遗留环境中,可以在系统日志放置它们的任何地方找到日志(可能 /var/log/messages
或类似的)。