JZ.
JZ.

Reputation: 21877

Docker for Jobs

I am trying to understand if this is a valid use case for Docker.

Suppose I am creating a python application, and the user submits a job of a specific type. I would like to then use docker run programmatically to start a docker image that is designed to process the job. The docker image would need to be able to receive the job, and then exit sending me a message that the job is successful.

Does this make sense? How could this be done using python? How can I observe docker containers and their status?

Or would it make more sense for the docker image to simply run on a loop, looking for jobs from a shared volume?

Upvotes: 0

Views: 82

Answers (1)

nathanleclaire
nathanleclaire

Reputation: 1180

It's not totally crazy idea but, you most likely would be better off having only one container which contains a server, that listens for requests to run a "job", and then runs the relevant R code. No need to start a container for each request if the image you're running will be the same every time, instead you just send an HTTP request.

If you really want to manipulate Docker with Python you can use docker-py. Docker Compose is based on this library.

Upvotes: 1

Related Questions