Answer the question
In order to leave comments, you need to log in
How to execute the exec command (docker-compose) so that the files created afterwards belong to the current user on the host machine?
Good afternoon!
When executing a command like
docker-compose exec web python manage.py startapp poll
Answer the question
In order to leave comments, you need to log in
If you do not specifically give the command you are running and the contents of your specific docker / compose files, then here is the answer corresponding to the question: you have an error somewhere, because it should work.
[email protected]:/tmp/test$ docker container run --rm -v ${PWD}:/tmp -u $(id -u ${USER}):$(id -g ${USER}) ubuntu:18.04 touch /tmp/it.is.my.file
[email protected]:/tmp/test$ ll
итого 20
drwxrwxr-x 2 user user 4096 янв 22 13:55 ./
drwxrwxrwt 23 root root 16384 янв 22 13:55 ../
-rw-r--r-- 1 user user 0 янв 22 13:55 it.is.my.file
[email protected]:/tmp/test$ rm it.is.my.file
[email protected]:/tmp/test$ docker container run --rm -v ${PWD}:/tmp ubuntu:18.04 touch /tmp/it.is.my.file
[email protected]:/tmp/test$ ll
итого 20
drwxrwxr-x 2 user user 4096 янв 22 14:01 ./
drwxrwxrwt 23 root root 16384 янв 22 14:01 ../
-rw-r--r-- 1 root root 0 янв 22 14:01 it.is.my.file
[email protected]:/tmp/test$
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question