I have these containers running:
I am able to visit node app at localhost:49160
and database at localhost:7474
as expected.
However, the node app can't seem to actually connect to the database. I get this error when I try:
Error: connect ECONNREFUSED 127.0.0.1:7474
at Object.exports._errnoException (util.js:1018:11)
at exports._exceptionWithHostPort (util.js:1041:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)
This normally means it can't find the database at that host:port.
Again, I am able to visit 127.0.0.1:7474
and clearly see the database is running.
I have also tried to connecting to 0.0.0.0:7474
, but that didn't work either.
There are no issues when I run the node app locally + database in docker container, but this problem occurs when I also run the node app in a docker container.
What host and port should be database be available at (what should I connect to?), and what am I probably missing or doing wrong?
Dockerfile for node-app
FROM node:boron
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
COPY package.json /usr/src/app/
RUN yarn
# Bundle app source
COPY . /usr/src/app
EXPOSE 8080
CMD [ "yarn", "start" ]
docker neo4j run cmd
docker run -d -e NEO4J_AUTH=none \
--publish=7474:7474 --publish=7687:7687 \
--volume=$HOME/neo4j/data:/data \
--volume=$HOME/neo4j/logs:/logs \
--volume=$HOME/neo4j/conf:/conf \
--volume=$HOME/neo4j/plugins:/plugins \
neo4j:3.1.4