Docker couchbase and Nodejs connection refuse (1024) - docker-compose

Viewed 17

Hi guys I've been debugging since yesterday I have nodejs app and couchbase images, the problem is my nodejs can't connect with my couchbase please see error below. every time I press the login button this error appears

(node:1) UnhandledPromiseRejectionWarning: Error: LCB_ERR_CONNECTION_REFUSED (1024): The 
remote host refused the connection

here's my docker-compose.yml

version: '3.9'
services:
  web:
   container_name: web
    build: .
    ports:
      - 3000:3000
    depends_on:
      - db
    links: 
      - "db:database"
  db:
    container_name: db
    image: couchbase
    ports:
      - 8091:8091
      - 8092:8092
      - 8093:8093
      - 8094:8094
      - 11210:11210

here's my Dockerfile in my node app

FROM node:12-alpine
WORKDIR /app
COPY . .
RUN yarn install
CMD ["node","index.js"]
EXPOSE 3000

and finally here's my connection string to couchbase index.js

const cluster = new couchbase.Cluster("couchbase://db:8091/",
    username: 'Administrator',
    password: 'password'
})
0 Answers
Related