Multiple resource may be specified but if they are files or directories then they must be relative to the source directory that is being built (the context of the build).
docker help cp
Usage: docker cp [OPTIONS] CONTAINER:PATH LOCALPATH|-
docker cp [OPTIONS] LOCALPATH|- CONTAINER:PATH
Copy files/folders between a container and your host.
Use '-' as the source to read a tar archive from stdin
and extract it to a directory destination in a container.
Use '-' as the destination to stream a tar archive of a
container source to stdout.
可以用資料磁碟區功能將主機的目錄掛載到容器裡
Dockerfile 中
ADD
和COPY
指令不能使用絕對路徑,只能使用相對路徑。這點在官方文件中所說的比較清楚https://docs.docker.com/reference/builder/#add 。docker 的cp指令可以從容器往外複製,也可以從本機複製的容器。
docker cp more.log e7de404c00bd:/tmp/