Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker run does not display any output

I installed docker on a raspberry-pi (Connected via ssh) Installation is successful.

But running docker run hello-world produce no output.

Note on very first time I got additional messages regard installing image

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

But there is no actual output from hello world script

Note I installed docker using command curl -sSL https://get.docker.com | sh

I tried following command too

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

Tried following commands 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 
like image 821
shakthi Avatar asked Sep 08 '18 07:09

shakthi


People also ask

How do I view the output of a docker container?

docker logs <container id> will show you all the output of the container run. If you're running it on ECS, you'll probably need to set DOCKER_HOST=tcp://ip:port for the host that ran the container. My container is already stopped. Using the cmd line doing, docker run -d image, it returns me the container id.

Why is docker not working?

Go to Docker and check whether Docker Desktop Service is running or not. If it is not running then right-click and click on Start. Another step is to verify if the Windows Features are enabled: Hyper-V and containers.

Does docker run pull the image?

By default, docker pull pulls images from Docker Hub. It is also possible to manually specify the path of a registry to pull from. For example, if you have set up a local registry, you can specify its path to pull from it. A registry path is similar to a URL, but does not contain a protocol specifier ( https:// ).


2 Answers

I ran into the same issue on a Raspberry Pi 1B+ (armv6l). Inspired by @JanDrábek's answer, the first observation is that the hello-world image would indeed be one supporting ARM, yet only after using hypriot/armhf-hello-world instead did I get the expected output:

$ 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. 
like image 88
fuglede Avatar answered Oct 17 '22 04:10

fuglede


run:

docker ps -a 

and check if you can see the exited container.

take the container ID from the output and type

docker logs <ID> 

this will allow you to see the logs.

if you want to see the output in the first place when you run it add -it flags to the run command

edit:

I tried in on my machine:

docker run -it hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world d1725b59e92d: Pull complete  Digest: sha256:e366bc07db5e8a50dbabadd94c2a95d212bc103e3557e47df8a2eebd8bb46309 Status: Downloaded newer image for hello-world:latest  Hello from Docker! This message shows that your installation appears to be working correctly. 

maybe your output is redirected to some other stream. try using :

docker run -it hello-world > ./test.txt 2>&1 

after that check if the file has any content

like image 43
eran meiri Avatar answered Oct 17 '22 04:10

eran meiri