Error starting userland proxy: listen tcp6 [::]:8065: socket: address family not supported by protocol

I am using the latest official mattermost docker repo. I forked from it an modified the .env and docker-compose file to be used with mariadb. I was able to deploy this fine in a test network but when moving it into deployment I get the following error:

./up.sh
mariadb_mattermost is up-to-date
Starting mattermost ... error

ERROR: for mattermost  Cannot start service mattermost: driver failed programming external connectivity on endpoint mattermost (----redacted----): Error starting userland proxy: listen tcp6 [::]:8065: socket: address family not supported by protocol

I believe the difference between the networks is that the deployment does not use ipv6. Unfortunately it seems like Docker now defaults to enable ipv6. My first attempt was to modify the docker-compose to force ipv4 such as the following but this does not work:

- port
    "localhost:8056:8056"

I have also tried “localhost:8056:8056” but in either case docker-compose will provide a parsing error.

Is there a way to modify the project to disable ipv6? If the issue is not ipv6 does anyone have any suggestion what could be the cause of this error?

Nevermind I fixed the solution. I need to enforce ipv4 by defining an ipv4 address. In my case I was hosting on localhost so I used 0.0.0.0.

    ports:
       - localhost:8065:8065