Copy a file to a Docker container just before star

2020-04-20 06:58发布

I know that you can copy a file from host to a running Docker container using docker cp, but in my case I want to copy it just before starting the docker container. How can I do that?

Note that I don't want this file in my built docker image, so I cannot copy it at build time even. Another way is to use mounted volumes (with -v), but I don't want that either.

标签: linux docker
1条回答
爱情/是我丢掉的垃圾
2楼-- · 2020-04-20 07:43

you can do something like this:

docker create mycon
docker cp /myfiles/file mycon:/path/file
docker start mycon
查看更多
登录 后发表回答