From 48318b1dd10be7812ca8fb93dbf28d85a5b41d99 Mon Sep 17 00:00:00 2001 From: "webuser@infra.woelkchen.at" Date: Mon, 20 Feb 2023 19:30:13 +0100 Subject: [PATCH] adds manual networking to compose --- docker-compose.yml | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7b3fc80..1d90393 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,19 +1,22 @@ version: '3' services: - database: - image: postgres:15 - container_name: bump-database - environment: - - POSTGRES_USER=postgres - - POSTGRES_PASSWORD=postgres - - POSTGRES_DB=db - restart: unless-stopped - volumes: - - ./postgres-data:/var/lib/postgresql/data - - ./postgresql.conf:/etc/postgresql.conf - command: postgres -c config_file=/etc/postgresql.conf - ports: - - "5555:5555" + bump-database: + image: postgres:15 + container_name: bump-database + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + - POSTGRES_DB=db + restart: unless-stopped + volumes: + - ./postgres-data:/var/lib/postgresql/data + - ./postgresql.conf:/etc/postgresql.conf + command: postgres -c config_file=/etc/postgresql.conf + ports: + - "5555:5555" + networks: + bump-network: + ipv4_address: 172.20.0.2 bump-server: build: context: ./bump @@ -23,5 +26,16 @@ services: - ../bump_server:/app ports: - "4012:4012" + networks: + - bump-network + extra_hosts: + - "database:172.20.0.2" depends_on: - database + + +networks: + bump-network: + ipam: + config: + - subnet: 172.20.0.0/16