Copy folder with wildcard from docker container to host

余生长醉 提交于 2019-12-05 01:25:34

You can create the mongo dump files into a folder inside the container and then copy the folder: this is a workaround.

It seems there is no way yet to use wildcards with the docker cp command https://github.com/docker/docker/issues/7710.

I think the best way to handle what you want to do is to use docker volumes, so you can directly save the files from the container into your host folder without using any other command: https://docs.docker.com/engine/userguide/containers/dockervolumes/

I had a similar problem, and had to solve it in two steps:

$ docker exec <id> bash -c "mkdir /extract; mv /path/to/fileset* /extract"
$ docker cp <id>:/extract .
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!