How to put two python scripts in docker container?

Hello,
I have two python scripts and I want to put them in a docker container. The output of one python script is written on a text file and this text file is read by the second code which is a dash-plotly dashboard.
My task now is to containerize them by docker. I build, run and curl docker container but it seems that the data is not sent properly. I attach the Dockerfile in this question. consolid.py is the code for dashboard and demonstrator_dynamic_2_0.py is the code that I need its output to run the dashboard. The output of one is input for the other. Can I put them in one container or should I create two and how?
I hope I could get a clue for my question.
Best, Misham

I’m not a docker expert but if you need the output of demonstrator_dynamic_2_0.py where is that python file actually being run? Right now it only looks like the docker container is running consolid.py, so is the former python file being run as part of the latter being run?

2 Likes

Thanks, good point. A person from docker community told me to use docker run command two times.
once for the first script and another time for the second script, I did and now I have errors, I do something wrong as I am new to docker, I don’t know how to run docker.

Yea as a rule for docker you can only have one CMD command in a docker file, if there is more than one it overrides the ones previous to it.

The simple solution is to run the demonstrator_dynamic_2_0.py as part of the consolid.py script, can you integrate the two perhaps? Maybe at the start of consolid.py run the other script and continue on?

1 Like