I run a simple Flask application in a docker container.
To run it i do :
docker run --name my_container_name my_image_name The logs are redirected to stdout. So after this command, i see as an output :
* Serving Flask app 'main' * Debug mode: off WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Running on all addresses (0.0.0.0) * Running on http://127.0.0.1:8080 * Running on http://172.17.0.2:8080 Press CTRL+C to quit When i want to get the logs with a separate command, i do :
docker container logs my_container_name It returns well the logs. Exactly the same output as the output written above.
But if I try to redirect the output to a file :
docker container logs my_container_name > mylogfile.log I don't get all the logs! I get only :
* Serving Flask app 'main' * Debug mode: off Why that ?
2>&1to the end of that command help?