I want to make a script run a series of commands in a Docker container and then copy a file out. If I use docker run to do this, I don't get back the container ID, which I would need for the docker cp. (I could try and hack it out of docker ps, but that seems risky.)
It seems that I should be able to
- Create the container with
docker create(which returns the container ID). - Run the commands.
- Copy the file out.
But I don't know how to get step 2. to work. docker exec only works on running containers...