Two Containers with the same IP addr

Hi, i am building a proxy server and for testing i want to use docker.
for my usecase i need an agent that runs on each container as well as the main app i want to forward my traffic to, i understand i can create a custom network and map containers their own ip addrs, but is it possible to create another container for the agent on the same ip addr of the container, if so how and if not how can i have my agent running as a background task to immetate a VM?

currently i have this compose file:

services:
  heavy-app-0:
    image: fluxgate-heavy-app
    container_name: heavy-app
    build:
      context: ./heavy-app
    ports:
      - "3000"
    environment:
      - NODE_ENV=production
      - PORT=3000
    command: node index.js
    networks:
      agent-net:
        ipv4_address: 172.18.0.10

  heavy-app-1:
    image: fluxgate-heavy-app
    container_name: heavy-app-1
    build:
      context: ./heavy-app
    ports:
      - "3000"
    environment:
      - NODE_ENV=production
      - PORT=3000
    command: node index.js
    networks:
      agent-net:
        ipv4_address: 172.18.0.11

networks:
  agent-net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.18.0.0/24
          gateway: 172.18.0.1

the proxy server runs on my main machine and connects to those containers via their ip addrs. help getting the agents running will be appricated

Since it is not possible to assign an ip twice to devices in the same subnet, you are probably looking for network_mode: service:{name of the service in the same compose file}, which allows a container to join the network namespace of another container. Published ports must be added to the container that owns the network namespace.

See https://docs.docker.com/reference/compose-file/services/#network_mode

this looks exacly like what i was looking for thanks.