Sort of new to docker environment and microservices and I want to dockerize my python executable file ( it is in .exe format) . Im looking at an ubuntu base image which takes cares of all my dependencies and has my source code in. But as I understand, Ubuntu does not support .exe applications. So how do I convert my application into an executable file format and then build a docker Image out of that? Also, the way my application works is by providing input files so that the applications reads the data, transfroms it and puts the transformed data into a different file. However , these input files keep changing and my understanding is that docker images are immutable, I do not want to build a docker container every time I have to provide new input files. Is there a way I can provide these files outside the container so that docker can pick the files up and write the output files in a folder outside the container?
CodePudding user response:
Python is an cross-platform scripting language, so I think there's no need for you to run the packed executable in Docker. Try building a image for the script itself as described here
CodePudding user response:
Linux in general does not natively handle .exe files (you'd need Wine or something similar for that) but provided your application does not container GUI and/or windows specific libraries you could easily use the python base image (found here on docker hub) to create your own.
You are correct in stating the container itself should be immutable. If you want it to have access to files outside the container you can easily mount (docker documentation on mount here) a directory on the docker host to check for its files.
Your situation has 1 caveat though. If it's indeed a script with a set end the container will run once and then quit. You'd have to start the container for each transformation. This is not unlike the way Docker was meant to be running (as in: run 1 process which might be infinite like a webserver, or finite like a script). If you run a webserver of some kind the container will keep running until that process is stopped. So that is something to keep in mind.
FWIW: As a last thought; do check if you really need to containise this. Putting stuff in a container is not always a great solution. If you can run it natively on your host that might be a better solution.