maverick maverick - 5 months ago 51
Python Question

Docker: how to see output/error of CMD [ "python", "./" ]

I am using docker compose for multi-container setup for my project. For that I need some data in my mongodb image and I have created a python file for same. Now in the build process, I am only getting below message in the console and not any other stdout/sterr messages.

Step 12 : CMD python ./
---> Running in 352b86106f68
---> fe091f22c2db

I have tried below options in my dockerfile

CMD ["/bin/sh", "-c", "python > server.log 2>&1"]
CMD [ "python", "./" ]

But I am not getting any success and also I couldn't see any error/output messages

See my Dockerfile at


The Docker Reference states: "There can only be one CMD instruction in a Dockerfile. If you list more than one CMD then only the last CMD will take effect." (

Why don't you perform your actions with a RUN instruction?