I have a Node.js application that connects to neo4j. Running it normally works well, I'm able to connect. However, when I run it inside Docker I run into this error:
Neo4jError: Failed to connect to server. Please ensure that your database is listening on the correct host and port and that you have compatible encryption settings both on Neo4j server and driver. Note that the default encryption setting has changed in Neo4j 4.0. Caused by: connect ECONNREFUSED 127.0.0.1:7687
at newError (/usr/src/app/node_modules/neo4j-driver/lib/error.js:75:10)
at NodeChannel._handleConnectionError (/usr/src/app/node_modules/neo4j-driver/lib/internal/node/node-channel.js:229:41)
at Socket.emit (events.js:310:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Where is the neo4j instance?? is this in the same container?? If neo4j is outside, the container can´t see its local server (because the container is isolate from the world, is similar to VM), you should have a neo4j server with public and visible IP. You can use neo4j sandbox if you want to test neo4j.
@Layvier, could you solve your issue ?
I'm also unable to connect to my neo4j container from another container, while I have no issues connecting to the same neo4j container from my system cypher-shell or neo4j desktop.
api_1 | Failed to connect to server. Please ensure that your database is listening on the correct host and port and that you have compatible encryption settings both on Neo4j server and driver. Note that the default encryption setting has changed in Neo4j 4.0. Caused by: connect ECONNREFUSED 172.19.0.2:57687