Localhost and docker-compose networking issue

Using network_mode: host on the service patient-processor, your patient-processor container it’s in your host network and dynamodb export the port 8000 in you host network; in this way
you can call dynamodb using localhost:8000 inside you patient-processor container

patient-processor:
  image: matchbox/nci-match-patient-processor:latest
  entrypoint: /docker-compose-env.sh
  network_mode: host
  depends_on:
    - dynamodb
  ports:
    - "3010:3010"
  environment:
    - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
    - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
    - RAILS_ENV=development
dynamodb:
  image: matchbox/dynamodb-local:latest
  ports:
    - “8000:8000”
1 Like