title: Unable to connect remotely with Redis based Nestjs microservice
body: <p>I have a Redis based dockerized microservice that I have deployed on a vps.
  In main.ts, this is how the service is exposed:</p>
  <pre><code>const app = await NestFactory.createMicroservice(AppModule, {
      transport: Transport.REDIS,
      options: {
          url: &quot;redis://redis:6379&quot;
      }
  });
  await app.listen();
  </code></pre>
  <p>The redis is the service name within the docker-compose.yml</p>
  <p>I have it deployed on vps and it runs fine and I can ping/telnet to the server</p>
  <p>The client app is a regular dockerized NestJS app that tries to connect to the microservice in the following way:</p>
  <pre><code> ClientsModule.registerAsync([{
      name: &quot;PAIGHAM_SERVICE&quot;,
      imports: [ConfigModule],
      useFactory: (configService: ConfigService) =&gt; ({
          transport: Transport.REDIS,
          options: {
              url: &quot;redis://[IP-ADDRESS]:6379&quot;
          }
      }),
      inject: [ConfigService]
  }])
  </code></pre>
  <p>The <code>IP_ADDRESS</code> is the external IP assigned to the VPS hosting the microservice</p>
  <p>But the client is unable to connect to the service.
  I also health-checked but it times out:</p>
  <pre><code>return this.health.check([
      () =&gt; this.microservice.pingCheck&lt;RedisOptions&gt;(&quot;service&quot;, {
          transport: Transport.REDIS,
          options: {
              url: &quot;redis://207.180.210.3:6379&quot;
          }
      })
  ])
  </code></pre>
  <p>I have no clue what wrong I am doing.
  Any immediate help would be highly appreciated.</p>
  <p><strong>UPDATE:</strong>
  This is doker-compose.yml for the microservice:</p>
  <pre><code>version: &quot;3.5&quot;
  services:
    service:
      build:
        context: ../
        dockerfile: ./docker/service/Dockerfile
      volumes:
        - &quot;${API_FOLDER_PATH}/src:/app/src&quot;
      networks:
        - paigham-network
    db:
      build:
        context: ../
        dockerfile: ./docker/db/Dockerfile
      restart: always
      volumes:
        - db-data:/var/lib/postgresql/data
      environment:
        POSGRES_USER: postgres
        POSTGRES_PASSWORD: password
        POSTGRES_DB: paigham
      ports:
        - 5432:5400
      networks:
        - paigham-network
    redis:
      image: &quot;redis:alpine&quot;
      command: [ &quot;redis-server&quot;, &quot;--bind&quot;, &quot;0.0.0.0&quot;, &quot;--port&quot;, &quot;6379&quot; ]
      environment:
        - ALLOW_EMPTY_PASSWORD=yes
      volumes:
        - cache:/data
      ports:
        - 6379:6379
      networks:
        - paigham-network
    redis-commander:
      image: rediscommander/redis-commander:latest
      restart: always
      environment:
        - REDIS_HOSTS=local:redis:6379
      ports:
        - 8089:8081
      networks:
        - paigham-network
  networks:
    paigham-network:
      external: false
  volumes:
    db-data:
    cache:
      driver: local
  
  </code></pre>