Rpj
Rpj

Reputation: 6080

How to set ownership and permissions of files mounted via a docker volume

How to set ownership and permissions of a file mounted via a docker volume We want to set the ownership of files mounted by a volume to a user within the container using chown command and similarly set permissions using chmod command. How to do this

volumes:
  - $PWD/foo.pem:/opt/conf/foo.pem
  - $PWD/bar.pem:/opt/conf/bar.pem

Upvotes: 0

Views: 1959

Answers (1)

Slava Kuravsky
Slava Kuravsky

Reputation: 2816

You need to find out uid and gui of the container user with id username in container. Then chown uid:gid foo.pem outside of container.

Upvotes: 2

Related Questions