首页 > 解决方案 > Docker 运行不显示任何输出

问题描述

我在树莓派上安装了 docker(通过 ssh 连接)安装成功。

但是运行docker run hello-world不会产生任何输出。

请注意,我第一次收到有关安装映像的其他消息

Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world ad0f38092cf2: Pull complete Digest: sha256:e366bc07db5e8a50dbabadd94c2a95d212bc103e3557e47df8a2eebd8bb46309 Status: Downloaded newer image for hello-world:latest

但是 hello world 脚本没有实际输出

注意我使用命令安装了 dockercurl -sSL https://get.docker.com | sh

我也尝试过以下命令

sudo usermod -aG docker pi
sudo systemctl start docker
sudo docker run hello-world

尝试了以下命令 docker ps -a

CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                           PORTS               NAMES
734dd8f733d7        hello-world         "/hello"            About a minute ago   Exited (139) 59 seconds ago                          thirsty_bhaskara

标签: dockersshraspberry-pi

解决方案


我在 Raspberry Pi 1B+ (armv6l) 上遇到了同样的问题。受@JanDrábek 回答的启发,第一个观察结果是该hello-world图像确实是支持 ARM 的图像,但只有在使用之后hypriot/armhf-hello-world,我才得到预期的输出:

$ uname -a
Linux 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l GNU/Linux
$ docker run hello-world  # No output
$ docker image inspect hello-world | grep Architecture  # Arch looks right though
        "Architecture": "arm",
$ docker run hypriot/armhf-hello-world  # This does the job
Hello from Docker.
This message shows that your installation appears to be working correctly.

推荐阅读