Timeout when requesting service in container docker

0

I created a docker image with node, the image contains a project with a POST service that creates some information in redis. When I run the project out of the container and call the service the Postman returns 201 created normally. But when I run the container and try to get the call from Postman, it keeps looking until it's timeout. I have tried to modify the service host by putting the IP of the container but I did not succeed.

Dockerfile :

    FROM node:8

# Create app directory
WORKDIR /usr/src/ci-socket

docker-compose.yml :

redis:
      image: redis
      container_name: cache
      expose:
        - 6379
    app:
      build: ./
      volumes:
        - ./:/usr/src/ci-socket
      links:
        - redis
      ports:
        - 6003:6003
      environment:
        - REDIS_URL=redis://cache
        - NODE_ENV=development
        - PORT=6003
      command:
        sh -c 'npm i && node server.js'

This is the image of the successful return of the service outside the container:

Butwiththecontainerrunningitdoesnotlooklikethis:

Does anyone know how to solve this?

    
asked by anonymous 29.11.2018 / 13:21

0 answers