Say we have frontend
and backend
containers based on Docker Desktop (for Windows).
Backend
container uses port 9001
, and the frontend
container listens to 9001
.
The problem is that port 9001
is already in use by Windows 10 by the Intel driver, and it is impossible to run a container on this port:
Error response from daemon: Ports are not available: listen tcp 0.0.0.0:9001: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
Could you please advise what is the way to handle this port if there is no ability to change it directly from application code?
Best Answer
A couple of ways:
docker run
command, specify the host port to use, and set it to something other than9001
. i.e.-p 9002:9001
orDocker Compose
, i.e.Then use port
9002
instead of9001
when accessing the container from the host (Win 10).9001
port.