Getting console output from a Docker container

p.magalhaes picture p.magalhaes · Oct 12, 2015 · Viewed 22.6k times · Source

I build an image with Python installed and a Python application too. My Python application is a Hello, World! application, just printing "Hello, World!" on the screen. Dockerfile:

FROM python:2-onbuild
CMD ["python", "./helloworld.py"]

In the console I execute:

docker run xxx/zzz

I can see the Hello, World! output. Now I am trying to execute the same application, using the task from ECS. I already pulled it to Docker Hub.

How can I see the output Hello, World!? Is there a way to see that my container runs correctly?

Answer

dnephin picture dnephin · Oct 12, 2015

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.