ネットワーク を使用してみてください 、わかりませんが、多分それはあなたを助けることができます:
version: '3'
# ----------------
# CREATE NEW NETWORK
networks:
app:
driver: bridge
# ----------------
services:
due:
restart: always
build:
context: ./
dockerfile: ./docker/bot/Dockerfile
command: ./due
depends_on:
- due_database
# ---------------
# SPECIFY NETWORK
networks:
- app
# ---------------
due_database:
build:
context: ./
dockerfile: ./docker/database/Dockerfile
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD="docker"
entrypoint: /entry.sh
volumes:
- ./.dueutil_db:/dueutil_data
# ---------------
# SPECIFY NETWORK
networks:
- app
# ---------------