Network settings for docker-compose when installing on QNAP

Hi all. I’m trying to install HA using docker-compose file. I have a DNS server configured on my network with static names and DHCP. Therefore, I would like to understand how to configure the network in a container. If I use this setting

        ports:
            - "8123:8123"
        networks:
        - default

then everything is installed. But there is no access to the application using its IP address. As I understand it, this is because it received an address inside the Docker network.
If I make this setting

        ports:
            - "8123:8123"
        network_mode: host

then access to the application in the browser is possible using the IP address of my QNAP indicating the port, which is not very convenient.
At the same time, if you create a container, then there are network settings and a bridge. I tried to change it like this:

        network_mode: bridge
        ports:
            - "8123:8123"

but the IP is assigned from the 10th network, and not from mine. I tried adding the mac address this way:

        network_mode: bridge
        mac_address: "02:42:ac:11:00:02"
        ports:
            - "8123:8123"

but it didn’t help
How can I configure a network in a docker-composite file so that the container connects via a bridge and has its own mac address so that my DHCP server can assign an address to it?

Why do you want to use DHCP on a server?
Use static IPs on the server and just let it be assigned in the DHCP too, then it should work and you are not depending on the DHCP running for HA to work.

Perhaps I don’t understand you well. You say: “Use static IPs on the server and just let it be assigned in the DHCP too”, but that’s what I do. On my server (Mikrotik) static addresses are assigned to a group of my devices. This is convenient if you assign them static names in the DNS.

Yep, but there is no need to require the HA to request that DHCP address. just set it static in HA.

This of course might not solve the issue with the bridge.
A bridge setup will only work if your network drivers allow the network to be set to promiscuous mode, where it accept all traffic from the network and not just the ones for its hardware MAC.

If I install HA on my QNAP using Container Station, that is, without using a docker-composite file, then the bridge is easily configured there, and a mac is assigned to it and the container receives an IP from my Mikrotik. I would like to do the same thing using a docker-compose file.

I think it is called a MACVLAN.

It almost happened. Like this

version: '3'

services: 
    homeassistant:
        container_name: home_assistant
        image: homeassistant/home-assistant:2021.2.3
        restart: always
        networks:
          my_network:
            ipv4_address: 192.168.1.100
        ports:
            - "8123:8123"
        volumes:
            - /share/CACHEDEV1_DATA/docker/home_assistant:/config 
        environment:
            - TZ=America/Los_Angeles

networks:
    my_network:
        driver: macvlan
        driver_opts:
          parent: eth0
        ipam:
          config:
            - subnet: 192.168.1.0/24
              gateway: 192.168.1.1

An address from my local network is assigned. But here it is written by hand. I can’t seem to configure it to receive via DHCP.
If I do it like this

version: '3'

services: 
    homeassistant:
        container_name: home_assistant
        image: homeassistant/home-assistant:2021.2.3
        restart: always
        networks:
          - my_network
        ports:
            - "8123:8123"
        volumes:
            - /share/CACHEDEV1_DATA/docker/home_assistant:/config 
        environment:
            - TZ=America/Los_Angeles

networks:
    my_network:
        driver: macvlan
        driver_opts:
          parent: eth0

Then I get the address from the Docker internal network
If I do it like this

services: 
    homeassistant:
        container_name: home_assistant
        image: homeassistant/home-assistant:2021.2.3
        restart: always
        networks:
          my_network:
            ipv4_address: dhcp
        ports:
            - "8123:8123"
        volumes:
            - /share/CACHEDEV1_DATA/docker/home_assistant:/config 
        environment:
            - TZ=America/Los_Angeles

networks:
    my_network:
        driver: macvlan
        driver_opts:
          parent: eth0

It says that the dhcp address is invalid