Here is the docker-compose.yml configuration
version: '2' services: web: build: . ports: - "3030:3000" depends_on: - cache environment: - REDIS_PORT_6379_TCP_ADDR:"redis:6379" - MONGO_PORT_27017_TCP_ADDR:"mongodb://mongo:27017' cache: image: redis:latest ports: - "6379:6379" I lift with the docker-compose up command
After running nodejs from a web container, it cannot connect to redis . And throws an error - Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
As I understand the whole problem in the new version of docker-compose, how to link containers correctly?
Here is a working example from the old version that I took from here.
Dockerfile
FROM node:0.10.38 RUN mkdir /src RUN npm install nodemon -g WORKDIR /src ADD app/package.json /src/package.json RUN npm install ADD app/nodemon.json /src/nodemon.json EXPOSE 3000 CMD npm start
Dockerfileforwebservice just in case - Mikhail Vaysman