I use RockyLinux and I have installed Docker for my services. My docker-compose.yml file looks similar like this:
version: "3.9"
services:
service_a:
container_name: service_a
build: ./images/service_a
hostname: service_a
restart: always
environment:
TZ: 'Europe/Warsaw'
networks:
default_network:
ipv4_address: 172.16.238.20
aliases:
- service_a.lan
service_b:
container_name: 'service_b'
build: ./images/service_b
hostname: service_b
restart: always
environment:
TZ: 'Europe/Warsaw'
networks:
default_network:
ipv4_address: 172.16.238.21
aliases:
- service_b.lan
networks:
default_network:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.238.0/24
I have tried to communicate between the above services (let's assume that I connected from service_b to service_a). When I was analysing network trafic on one of container (let's asume that it is service_a) I noticed that all incomming traffic has incorrect ip address (172.16.238.1 instead of 172.16.238.21). I would like to get IP of service_b (172.16.238.21). What can I do to achieve this goal?