Skip to content

Redis doesn't connect with other image in docker #8

@DannyXY

Description

@DannyXY

Hello, so i'm trying to run redis side by side a NestJS API, dockerize it and run it in an AWS instance
I tested it locally with my redis and local system, it works fine
But whenever i run my docker-compose up, i get the ERRCONFUSED error 127.0.0.1:6379
But if i run the nestjs container outside docker, it connects to the dockerized redis
Here is my docker-compose file

version: '3.3'
services:
  redis: # Name of container
    image: redis:6.2-alpine
    command: ["redis-server", "--bind", "0.0.0.0", "--port", "6379"]
    container_name: redis
    restart: unless-stopped
    network_mode: nebula
    expose:
      - 6379
    ports:
      - 6379:6379
  prod:
    container_name: ad-promoter-api-new-d
    image: ad-promoter-redis-prod-new-d:1.0.0
    build:
      context: .
      dockerfile: ./Dockerfile
      target: prod
    command: npm run start:prod
    ports:
      - 80:80
    network_mode: nebula
    links:
      - redis
    volumes:
      - .:/usr/src/app
      - /usr/src/app/node_modules
    restart: unless-stopped

Any help at all is appreciated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions