Не запускается докер контейнер с базой данных
У меня проект на Джанго, где я использую PostgreSQL
. Я создал базу данных и перенес данные, после чего монтировал ее в Docker
. Какое-то время все запускалось, однако спустя 2-3 минуты контейнер с PostgreSQL
вылетал. Сейчас вообще не запускается. В логах пишет следующее:
2024-05-12 00:05:15 chmod: changing permissions of '/var/lib/postgresql/data': Operation not permitted
2024-05-12 00:05:16 chmod: changing permissions of '/var/lib/postgresql/data': Operation not permitted
2024-05-12 00:05:16
2024-05-12 00:05:16 PostgreSQL Database directory appears to contain a database; Skipping initialization
2024-05-12 00:05:16
2024-05-12 00:05:16 2024-05-12 00:05:16.066 MSK [1] LOG: starting PostgreSQL 16.3 (Debian 16.3-1.pgdg120+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2024-05-12 00:05:16 2024-05-12 00:05:16.066 MSK [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2024-05-12 00:05:16 2024-05-12 00:05:16.066 MSK [1] LOG: listening on IPv6 address "::", port 5432
2024-05-12 00:05:16 2024-05-12 00:05:16.068 MSK [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-05-12 00:05:16 2024-05-12 00:05:16.073 MSK [29] LOG: database system was interrupted; last known up at 2024-05-11 23:29:20 MSK
2024-05-12 00:05:16 2024-05-12 00:05:16.538 MSK [29] LOG: invalid resource manager ID in checkpoint record
2024-05-12 00:05:16 2024-05-12 00:05:16.538 MSK [29] PANIC: could not locate a valid checkpoint record
2024-05-12 00:05:16 2024-05-12 00:05:16.538 MSK [1] LOG: startup process (PID 29) was terminated by signal 6: Aborted
2024-05-12 00:05:16 2024-05-12 00:05:16.538 MSK [1] LOG: aborting startup due to startup process failure
2024-05-12 00:05:16 2024-05-12 00:05:16.538 MSK [1] LOG: database system is shut down
docker-compose.yml
version: '3.8'
services:
django:
build:
context: .
volumes:
- "./movies_admin:/movies_admin"
env_file:
- "movies_admin/config/.env"
depends_on:
- database
- elasticsearch
database:
image: postgres:16
environment:
- DB_NAME=movies_database
- DB_USER=app
- DB_PASSWORD=123qwe
volumes:
- /opt/homebrew/var/postgresql@16:/var/lib/postgresql/data
nginx:
image: nginx:latest
container_name: nginx
volumes:
- "./nginx/nginx.conf:/etc/nginx/nginx.conf"
- "./nginx/default.conf:/etc/nginx/conf.d/default.conf"
- "./movies_admin/movies_admin/staticfiles/admin:/etc/nginx/movies_admin/movies_admin/staticfiles/admin"
- "./movies_admin/movies_admin/staticfiles/rest_framework:/etc/nginx/movies_admin/movies_admin/staticfiles/rest_framework"
ports:
- "80:80"
depends_on:
- django
elasticsearch:
image: elasticsearch:8.13.0
container_name: elasticsearch
environment:
- "ES_JAVA_OPTS=-Xms200m -Xmx200m"
- discovery.type=single-node
- xpack.security.enabled=false
ports:
- 9200:9200
settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'movies_database',
'USER': 'app',
'PASSWORD': '123qwe',
'HOST': 'database',
'PORT': '5432',
'OPTIONS': {
'options': '-c search_path=public,content'
}
}
}