-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
questionUsability question, not directly related to an error with the imageUsability question, not directly related to an error with the image
Description
Im working with docker to create two containers: django & postgres.
What is my issue?
I want to create a volume in my project to has a database persistent and commit to my repository to download in another machine and has the same database. So, when I create a volume in my docker-compose.yml inside my project, after maked docker-compose up the folder created with volume of postgresql in my project, this have a permision like root, so I cant commit the folder in my repository...
This is my docker-compose file:
version: '3'
services:
db:
#build: ./postgresqlDocker/
image: postgres # Utiliza una imagen la cual en caso de no tener, la descarga
environment:
POSTGRES_USER: postgres #CREA UN USUARIO Y UNA BASE DE DATOS CON PRIVILEGIOS
POSTGRES_PASSWORD: password123 # LE ASIGNA UNA PASSWORD AL USUARIO Y SU BASE DE DATOS
POSTGRES_DB: test_db
ports:
- "5432:5432" # (HOST:CONTAINER)
volumes:
- ./data/postgres:/var/lib/postgresql/data/
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
# (HOST:CONTAINER)
ports:
- "8000:8000"
# (HOST:CONTAINER)
depends_on:
- db
This is the definition of database connection in my settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'postgres',
'USER': 'postgres',
'PASSWORD': 'password123',
'HOST': 'db',
'PORT': 5432,
}
}
And when I want to access to postgres folder:
cd data/postgres/ bash: cd: data/postgres/: Permission denied
I hope can you help me!
Thanks everyone!
Metadata
Metadata
Assignees
Labels
questionUsability question, not directly related to an error with the imageUsability question, not directly related to an error with the image