Connecting Redis from my network in docker .net Core application

It’s best to run your entire application stack in containers, so that includes Redis. It’ll make connecting the containers with each other easier. You can add the following:

version: '3.4'
services:
  apimodule:
    # ...
  redis:
    image: redis

Then connect to Redis like I’ve told you in the previous post. Don’t use localhost:6379 or 127.0.0.1:6379, that won’t work.

Otherwise, you could connect from your app container to Redis that’s running on your localhost, you’ll have to use host.internal.docker:6379. Last I checked it didn’t work on Linux though, they were still fixing it.

1 Like