Copying files from Docker container to host

后端 未结 18 2385
小蘑菇
小蘑菇 2020-11-22 13:39

I\'m thinking of using Docker to build my dependencies on a Continuous Integration (CI) server, so that I don\'t have to install all the runtimes and libraries on the agents

18条回答
  •  执念已碎
    2020-11-22 14:16

    Another good option is first build the container and then run it using the -c flag with the shell interpreter to execute some commads

    docker run --rm -i -v :  /bin/sh -c "cp -r /tmp/homework/* "
    

    The above command does this:

    -i = run the container in interactive mode

    --rm = removed the container after the execution.

    -v = shared a folder as volume from your host path to the container path.

    Finally, the /bin/sh -c lets you introduce a command as a parameter and that command will copy your homework files to the container path.

    I hope this additional answer may help you

提交回复
热议问题