Docker Community Forums

Share and learn in the Docker community.

Containers can not see eachother in swarm


(Dispersia) #1

Hello, I’m just beginning to learn docker. I have a swarm running, and I’m trying to get my asp.net core app to communicate with a redis server. I didn’t think I would have this many issues with it :frowning:

My docker-compose:

version: ‘3.3’

services:
webfarm_api:
image: dispersia/webfarm.api
ports:
- 8080:80
environment:
- SERVICE_PORTS=8080
depends_on:
- webfarm_redis

webfarm_redis:
image: dispersia/redis
ports:
- 6379:6379
volumes:
- ‘redis:/data’

volumes:
redis:

I have set my redis.conf to bind to 0.0.0.0, and in my app I have

services.AddDistributedRedisCache(options =>
{
options.Configuration = “0.0.0.0”;
options.InstanceName = “redisInstance”;
});

If I manually run a redis-server and my asp.net core app outside of docker, they see eachother and everything works, but I can’t for the life of me get it to work inside of docker.

If I run docker inspect network prod_default I get that both containers are running, and they do have different IP’s (10.0.0.6/24) and (10.0.0.4/24) However I thought that 0.0.0.0 would allow any container to see it within the same network. If I’m wrong in my assumption of that, please let me know.

Is this the correct way of making these containers communicate?

Thanks