Getting console output from Docker container

2019-06-28 03:03发布

I build an image with python instaled and a python app to. My python app is a hello world, just printing "Hello World" on 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 tryng to execute the same app, using the task from ECS. I already pulled it to Docker Hub. How can I see the output hello world? is the anyway yo see that my container run correctly?

3条回答
倾城 Initia
2楼-- · 2019-06-28 03:14

We Can Use

docker logs <container name>
查看更多
\"骚年 ilove
3楼-- · 2019-06-28 03:27

You can log in onto your container instance and do, for example, a docker ps there.

This guide describes how to connect to your container instance:

http://docs.aws.amazon.com/AmazonECS/latest/developerguide/troubleshooting.html#instance-connect

查看更多
SAY GOODBYE
4楼-- · 2019-06-28 03:28

docker logs <container id> will show you all the output of the conatiner 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.

查看更多
登录 后发表回答