Run python script in a container without python installed

I have a python script in one of my containers, but the container itself does not have python installed.
The container runs a task periodically which will call the python script.

What is the recommended way to make this work (if there is one)?
I do not have the option of adding python to the container itself.

Then I don’t think that you have any option, but I may have not enough information about your nvironment.

You can’t expect a container to run a script which doesn’t have the necessary libraries. This is the point of a container. Having the libraries embedded into that container If you could run anything in an environment without having the necessary runtime, it would mean that you actually run it in an other environment and you just call it from your container to let an other container do the job. It does not usually make sense, but there are some cases when a container’s job is actually running other containers using the docker socket mounted inside that container or using an API call with the necessary privileges.

Let’s say your container is running cron and this is how it runs something periodically. Without python, you can’t run any python script, but you can have a cronjob running “docker run” if your container has a working docker client with the docker socket mounted from the host or it has access to the TCP socket of the Docker daemon.

So you actually have options I just don’t think this is what you want if you can’t replace the cron container with an other that has python installed in it.

Like Akos wrote: you can not run something that requires a specific runtime without the runtime.

A workound could be to wrap a http-endpoint arround your script (I have no idea how to do it in python) and run it in its own container (of course you need to create an image first) in and then just use a curl command inside the container without python to querry the http-endpoint in the other container to perform the actions,