Wednesday, 31 May 2017

How do I connect to the localhost of a docker container (from inside the container)

I have a nodejs app that connects to a blockchain on the same server. Normally I use 127.0.0.1 + the port number (each chain gets a different port).

I decided to put the chain and the app in the same container, so that the frontend developers don't have to bother with setting up the chain.

However, When I build the image the chain should start. When I run the image it isn't. Furthermore, when I do go in the container and try to run it manually it says "besluitChain2@xxx.xx.x.2:PORT". So I thought instead of 127.0.0.1 I needed to connect to the port on 127.0.0.2, but that doesn't seem to work.

I'm sure connecting like this isn't new, and should work the same with a database. Can anyone help?



via Rachelle

No comments:

Post a Comment