I am trying to automate the following cycle using Docker: create a container, do some work inside it (more than one separate command), get some data from the container.
Something along the lines of:
for ( i = 0; i < 10; i++ ) spawn a container wget revision-i do something with it and store results in results.txt
According to the documentation, I have to go with:
for ( ... ) docker run <image> <long; list; of; instructions; separated; by; semicolon>
Unfortunately, this approach is not attractive and cannot be redirected, since the list of instructions is growing in complexity.
The wrapper of instructions in the script, as in docker run <image> /bin/bash script.sh , does not work, since I want to create a new container for each iteration of the loop.
Summarizing:
Is there any reasonable way to run a complex series as described above in a single container?
As soon as some data is stored inside the container, for example, /home/results.txt, and the container returns, how can I get result.txt? The only way I can think of is to transfer the container and tar file from a new image. Is there a more efficient way to do this?
Bonus: should I use vanilla LXC? I have no experience, although I'm not sure. Thanks.
source share