Docker - how can I copy a file from an image to a host?

前端 未结 8 717
庸人自扰
庸人自扰 2020-12-02 05:56

My question is related to this question on copying files from containers to hosts; I have a Dockerfile that fetches dependencies, compiles a build artifact from source, and

8条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 06:39

    Parent comment already showed how to use cat. You could also use tar in a similar fashion:

    docker run yourimage tar -c -C /my/directory subfolder | tar x
    

提交回复
热议问题