Docker compose connect containers from different networks

Hello I am using docker compose,

I want to know if it is possible to connect my containers from different network in the same host, I have network 1 “10.10.1.0/24” and network 2 “192.168.85.0/24”. Two containers are connected to the network 1 and they can communicate with each other “tested with ping command”, an other two containers in network 2, they can also communicate with each other.

here is my docker-compose.yml file

networks:
  network_1:
    driver: bridge
    name: "network_1"
    ipam:
      config:
        - subnet: 10.10.1.0/24
  network_2:
    driver: bridge
    name: "network_2"
    ipam:
      config:
        - subnet: 192.168.85.0/24

services:
  web_server_app:
    image: web_server_app:latest
    container_name: web_server_app
    hostname: web_server_app
    privileged: true
    stdin_open: true
    tty: true
    networks:
      network_1:
        ipv4_address: 10.10.1.5

  database_engine:
    image: database_engine:latest
    container_name: database_engine
    hostname: database_engine
    networks:
      network_1:
        ipv4_address: 10.10.1.4
    depends_on:
      - web_server_app

  client_1:
    image: end_user:latest
    container_name: end_user
    hostname: end_user
    networks:
      network_2:
        ipv4_address: 192.168.85.2
    depends_on:
      - web_server_app
      - database_engine

  sftp_server:
    image: sftp_server:latest
    container_name: sftp_server
    hostname: sftp_server
    depends_on:
      - web_server_app
      - database_engine
    networks:
      network_2:
        ipv4_address: 192.168.85.3

I want that containers on network 1 communicate with containers on network 2, what is the good way to do it?

Thank you

Containers can communicate only on the same network by design. That way you can make sure that if a service does not have tto access to a dabase, it will not be able to.

Ah I see, as a way for security I guess. Noted.