Port forwarding not working on Docker Desktop for Mac for one particular container

I use docker compose quite a lot on Linux and have no issue like this. I’m now trying to use Docker Desktop on a Mac but finding the port forwarding to the container is not working. I copied and slightly modified my working compose YAML from Linux onto the Mac and everything looks fine on startup of the container, but I can’t reach the web UI of the contained application.

The web UI runs on port 9091 in the container, so I’ve forwarded the same port from the host to the container. Trying to use curl to reach it from a terminal doesn’t work. Running a shell in the container and testing the same works fine.

The compose file looks like:

name: compose
services:
  transmissionvpn:
    cap_add:
      - NET_ADMIN
    container_name: transmissionvpn
    dns:
      - 1.1.1.1
      - 1.0.0.1
    environment:
      LOCAL_NETWORK: 192.168.4.0/24
      OPENVPN_OPTS: ""
      OPENVPN_PROVIDER: custom
      OPENVPN_CONFIG: openvpn
      OPENVPN_USERNAME: ...
      OPENVPN_PASSWORD: ...
      PGID: "1000"
      PUID: "1000"
      TRANSMISSION_DOWNLOAD_DIR: /storage/completed
      TRANSMISSION_HOME: /config
      TRANSMISSION_INCOMPLETE_DIR: /storage/incomplete
      TRANSMISSION_WATCH_DIR: /storage/watch
      TRANSMISSION_RATIO_LIMIT: 5
      TRANSMISSION_RATIO_LIMIT_ENABLED: true
      TRANSMISSION_BLOCKLIST_ENABLED: true
      TRANSMISSION_BLOCKLIST_URL: https://github.com/Naunter/BT_BlockLists/raw/master/bt_blocklists.gz
      TRANSMISSION_WEB_UI: combustion
      TZ: US/Eastern
    hostname: docker
    image: haugene/transmission-openvpn:latest
    logging:
      driver: json-file
      options:
        max-file: "10"
        max-size: 200k
    ports:
      - mode: ingress
        target: 51413
        published: "51413"
        protocol: tcp
      - mode: ingress
        target: 51413
        published: "51413"
        protocol: udp
      - mode: ingress
        target: 6881
        published: "6881"
        protocol: tcp
      - mode: ingress
        target: 6881
        published: "6881"
        protocol: udp
      - mode: ingress
        target: 9091
        published: "9091"
        protocol: tcp
    restart: unless-stopped
    volumes:
      - type: bind
        source: /etc/localtime
        target: /etc/localtime
        read_only: true
        bind:
          create_host_path: true
      - type: bind
        source: /Users/user/docker-testing/config/appdata/transmissionvpn
        target: /config
        bind:
          create_host_path: true
      - type: bind
        source: /Users/user/docker-testing/storage
        target: /storage
        bind:
          create_host_path: true
      - type: bind
        source: /Users/user/docker-testing/config/appdata/openvpn
        target: /config/openvpn
        bind:
          create_host_path: true
      - type: bind
        source: /Users/user/docker-testing/config/appdata/openvpn
        target: /etc/openvpn/custom
        bind:
          create_host_path: true

MacOS: 14.5
Docker Desktop: 4.31.0 (153195)

This has been a recurring problem with Docker Desktop for MacOS apparently: Unable to connect to containers after upgrade to MacOS docker desktop v4.23 · Issue #2723 · haugene/docker-transmission-openvpn · GitHub