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?
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.
1. Using COPY or ADD command: You can use COPY or ADD command within Dockerfile to copy your file/code into the Docker container. The following Dockerfile example shows how to add the current working directory files and folders into the directory /usr/Qxf2_POM of the container image.
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.
To view the logs of a Docker container in real time, use the following command:
docker logs -f <CONTAINER>
The -f
or --follow
option will show live log output. Also if the container is stopped it will fetch its logs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With