我有 3 个 docker 容器 web(django)、nginx、db(postgresql)
当我运行以下命令时
docker-compose -f docker-compose.prod.yml exec web python manage.py migrate --noinput
Run Code Online (Sandbox Code Playgroud)
确切的错误是:
django.db.utils.OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Address not available
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)
docker-compose.prod.yml
version: '3.7'
services:
db:
image: postgres:12.0-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
env_file:
- ./.envs/.db
web:
build:
context: ./tubscout …Run Code Online (Sandbox Code Playgroud)