简体   繁体   中英

docker: is it possible to run containers from an other container?

I am running a dockerized python web application that has to run long tasks on certain requests (ie running some R scripts taking around 1 minute to complete). At the moment I put everything in one container and I am just running it just like this.

However, I think that it would be faster and cleaner to separate this 'background web app' and the R scripts one process = one container). I was therefore wondering if there is a way to run a container from within an other container (ie being able to call docker run [...] on the host from the already-dockerized web application).

I tried to search for it and found some useful information on linking containers together, but in my case I'd more be interested in being able to create single-use containers on the fly.

I quite like this solution: Run docker inside a docker container? which basically allows you to use docker that's running on the host.

But if you really want to run docker in docker, here is the official solution using the dind image: https://blog.docker.com/2013/09/docker-can-now-run-within-docker/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM