I have researched endless sources for an answer, but I simply can’t get this to work. I’ve read about the shortcomings between Docker for WIndows and port-mapping, etc., and unfortunately the workarounds haven’t pointed me at success. I should add that I have little to no background in docker, and that I run Docker Desktop for Windows. Many sources are talking about docker run commands, but I know little about how to integrate that with the environment Docker Desktop already creates for me via docker-compose up -d.
What I am trying to do:
Run my Node.js server locally on localhost:4444 (Windows 10). This provides a graphql playgound.
The Node server should communicate with a Prisma server. The Prisma server exposes port 4466 from within a Linux container (standard per the docs), and to my Windows machine so that graphql can write modifications to it.
A MySql database runs in parallel to the Prisma server from inside its own Linux container.
What I’ve tried:
grab all kinds of IPs from ipconfig, docker ps, change bridge as the network_mode, and some other things.
Please help me get this to work once and for all. I’ve already spent entirely too many days trying to figure this out.
Where or how do I get the appropriate IP on Windows 10 to connect my local server to the Docker container?
If it’s not an IP issue, what do I need to do to connect the two servers?
Your node.js Server is not hosted in docker?
The clean solution would be to move the node.js server in docker aswell. This will make everything clean and easy.
This should probably do the job, but doesn’t work in Docker Desktop. https://docs.docker.com/network/network-tutorial-host/
Ideally only the Prisma server and the database are inside Docker. The node server being inside as well shouldn’t make a difference to the issue because at some point the containers will have to communicate to the outside.
Unfortunately, it seems that the docker0 bridge is unavailable on Windows, see here.
The same page talks about using docker run, like so many other resources before. Given that I have the above docker-compose file, how do I make sure all those arguments are represented via tags on my docker run command? It would be a really really long command to enter, between docker run -d -p -h -xxx etc
Docker Desktop has many problems. It is possible that what you want is straight impossible.
[…] at some point the containers will have to communicate to the outside.
Do you mean that then containers need to be accessible from the outside because thats no problem. Or do you mean that the containers need to access something from the outside?
Docker-Compose is just a wrapper for docker service create (which can be almost equal to docker run). (Almost) any docker run / service create command can be converted to a docker-compose file and vice versa. To convert one to another you have to translate the statements using the docker-compose reference (Overview | Docker Docs) and the docker run reference (docker run | Docker Docs)