Starting server listening for requests from Docker container on mapped port error Socket access permission denied

I have a Docker container with an application that sends http POSTs to a configurable endpoint. I am trying to create a http listener on the host machine that listens for these POST messages, by adding a port mapping (eg 8085:8085) and starting a listener on port 8085 on the host.

I am getting the error

An attempt was made to access a socket in a way forbidden by its access permissions

I have confirmed it isn’t an issue with my implentation. I have tried with multiple libraries in both Python and c# and get the same result. When i stop the docker container, the listener binds to the port.

I assume this is a fairly standard issue.
Is there a ‘best-practice’ way to achieve what i want to do, or any workarounds?

Source: StackOverflow