0

This is my docker-compose file that runs when I do docker-compose up -d on mac. I am now trying this on windows, with docker-toolbox (as docker desktop isn't supported on my windows). I run my application on http://localhost:1337 and then the application needs to talk to inside this container. Works totally fine on mac.

version: '3.4'

services:

  # Add a redis instance to which our app can connect. Quite simple.
  redis-dev:
    image: redis:5.0.5-alpine
    ports:
      - 6379:6379

  # Add a postgres instance as our primary data store
  postgres-dev:
    image: postgres:11.5-alpine
    environment:
      - POSTGRES_DB=the-masjid-app
    ports:
      - 5432:5432
    volumes:
      # Here we specify that docker should keep postgres data,
      # so the next time we start docker-compose,
      # our data is intact.
      - the-masjid-app-pgdata-dev:/var/lib/postgresql/data

  # Add a postgres instance as our primary data store
  postgres-test:
    image: postgres:11.5-alpine
    environment:
      - POSTGRES_DB=the-masjid-app
    ports:
      - 5433:5432

# Here we can configure settings for the default network
networks:
  default:

# Here we can configure settings for the postgres data volume where our data is kept.
volumes:
  the-masjid-app-pgdata-dev:

Doing the same thing in Windows is giving me:

Error: Redis connection to localhost:6379 failed - connect ECONNREFUSED 127.0.0.1:6379 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)

Any ideas on how to fix?

Noitidart
  • 35,443
  • 37
  • 154
  • 323
  • 1
    Where is the application running? (On the host, since it doesn't seem to be in the `docker-compose.yml` file?) What flavor of Windows/Docker? (Are you using Docker Toolbox?) – David Maze Mar 29 '20 at 14:21
  • Thanks @DavidMaze the application is running on the computer, localhost:1337 - windows 10 and using Docker Toolbox because Docker Desktop wasn't compatible or something. On mac this works just fine. Its so baffling. – Noitidart Mar 29 '20 at 20:57
  • 1
    On Docker Toolbox you need the `docker-machine ip` address instead of localhost, for example `REDIS_HOST=192.168.99.100`. – David Maze Mar 29 '20 at 20:59
  • Thank you @DavidMaze! I will try and let you know so we can convert this to answer. Thanks very much! I need some time (i was actually helping someone else, waiting for him to get online) – Noitidart Mar 30 '20 at 00:44
  • @DavidMaze yes that was it! may you please make that solution ill accept. thank you so much! – Noitidart Mar 30 '20 at 02:21

0 Answers0