Docker compose - internal network configuration

Hi all,

I’ve had no specific network configuration before and it worked fine.
The thing is, I had to share both external and internal IP address of the service with my contragent in order to set VPN access. They set all needed security policies and everything worked fine.

The thing is that I had to reinstall my server and then, once I build my docker container again, the internal IP address became different. Now, I can share the new internal IP address of the service with the contragent, but it seems to me that it is not exactly professional, creates additional action required from the contragent and can be done as the last resort.

Thus my question is, how do I set needed internal IP address manually?

It was 172.18.0.0/16, now it became something like 172.19.0.0/16 or so.
Once I set it as 172.18.0.0/16 manually, the service is available inside the docker container when I log into it and check inside using something like curl, telnet or nmap

docker exec -it abcde /bin/bash

but it is not available from the host machine.

My docker-compose.yml file:

version: '3.9'
services:
  jupyter:
    build: .
    privileged: true
    ports:
      - "8888:8888"
    networks:
      mynetwork:
        ipv4_address: 172.18.0.2

networks:
  mynetwork:
    ipam:
      config:
        - subnet: 172.18.0.0/16
$ /usr/bin/docker --version
Docker version 26.1.4, build 5650f9b

Please advise.