File ownership after docker cp

前端 未结 4 2065

How can I control which user owns the files I copy in and out of a container?

The docker cp command says this about file ownership:

The cp

4条回答
  •  旧巷少年郎
    2021-02-19 23:43

    Just a one-liner (similar to @ramu's answer), using root to make the call:

    docker exec -u 0 -it  chown node:node /home/node/myfile
    

提交回复
热议问题