Docker volume, change file permissions/owner

2019-08-09 01:49发布

I'm running ruby on rails in a docker container. If I generate something like docker-compose run rails rails g controller posts index show, the file owner is root. After that I must always run chown -R . $USER and this is annoying.

Does any one know how I can fix this, so that the owner from each generated file is the host user?

1条回答
Deceive 欺骗
2楼-- · 2019-08-09 02:06

You can run with docker-compose run --user $USER, but that user must already exist in the container, so you'd have to create it in your Dockerfile.

查看更多
登录 后发表回答