G
G
GregIv2019-02-14 12:41:17
Xubuntu
GregIv, 2019-02-14 12:41:17

How to tell docker the linux user from which to create files (laravel migrations)?

Good day!
Environment:
Win10 -> VmWare -> Xubuntu + PhpStorm + Docker + Docker-compose
Issue:
Generating migrations for laravel:

sudo docker-compose exec php-cli php artisan make:migration TABLE_NAME

They are correctly created in the "value directory", but their owner is root, so I can't edit them.
Bad decisions
1) I change the rights to the necessary files (very inconvenient)
2) I run phpstorm as root (not safe, and could not make friends with the browser during debugging)
Not working solution
Also, I tried to get rid of sudo, using the second method from this article . I got rid of sudo, but the problem remained, new files are still owned by root.
Question
How to tell docker the linux user from which to create files (laravel migrations)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaliy Orlov, 2019-02-14
@GregIv

docker exec has a -u parameter in which you can specify a user or his uid
. I think you can even change the root uid in the container to the same as you have on the host machine and as a result, migrations will be created inside the container from root, and in volume to the host the car will belong to you. But it is not exactly :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question