Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
448 views
in Technique[技术] by (71.8m points)

django - Why is docker-compose creating files with a root owner and how can I modify the docker-compose.yml file to stop it?

I am building a Django app to run using Docker.

In the docker-compose.yml file, I am using volumes to save changes.

services:
  web:
    build: .
    command: python /code/manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/code
    ports:
      - 8000:8000 

When I create a new application within the Django project, I use...

docker-compose exec web python manage.py startapp app_name 

Docker-compose writes the app (app_name) to my local file, as expected, but with a root owner. This is causing problems, because, if I want to then create a new file within the app, I don't have permission.

If I exit docker-compose and create the app as a user, then there are no issues.

How can I change the .yml file to fix this?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...