Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Linking becomes more easy if you use docker-compose.
You have to link the mysql container to the node app container. It's a pain doing this via `docker run` -
ManuLG4297yUse docker-compose and link both services. The you can use the name as the ip of the other service, and you can connect .
-
thiemok737yTry to use container networking if you can, since container links are marked as deprecated. If you create your own bridge network (docker-compose does that for you) you can just use container name resolution to connect to other containers.
-
pric1937yDocker compose is my new girlfriend. Everything is simple with her, she made me love docker even more.
-
@thiemok I am using compose, but I get "connection refused" when I use file_get_contents("http://api") in my PHP container, where api is the name of the node container.
Also tried setting up user-defined networks simply by defining them and adding all services to it. -
thiemok737y@SpectralKH on which port is your node service running? And did you expose it in your Dockerfile?
-
@k0pernikus @thiemok I don't know what to feel... I've spent like 6 hours figuring this out (Thank you)
OH MY GOD DOCKER I JUST WANT NODE TO CONNECT TO THE DAMN MYSQL CONTAINER!
its probably easy but jesus there is so much weird documentation to go through and hope something works...
undefined