Redis on the internal subnet

I’m trying to get redis to work only on the private subnet (eg. shared only with other docker containers).

This is not working well.

I’ve turned protected mode to no
I’ve tried turning bind off AND I’ve tried binding to

The server will work if I expose the port, binding it to the container’s port and make it publicly accessible, but that is not the end goal. I really would like redis to run on the 10.42.* subnet, and only be visible to my other docker containers. I want the host to be ephemeral as I’m not stating redis to disk at all, I don’t want to set up firewall rules on the host etc.

I’m sure a bunch of you folks out there have done this, I would just like a direction to head. Thank you very much for reading this!

I am running several servers on the private network, unexposed, and they are all accessible to their downstream consumers, but redis is being a butthead.

Have you tried something like this:

  image: redis
    REDIS_IP: redis
  image: docker_image_that_use_redis
  - redis:redis

replace docker_image_that_use_redis with your images, that connects to redis and this should work.

That was very very similar to my configuration.

It turns out that when the process starts, for some reason the subnet is unavailable, but the host networks are. I’ve “fixed” it by deferring all connections until after init() and just adding a redis connection checker to the healthcheck.

This doesn’t seem to be a problem with anything other than redis though. And how I found it was I stopped launching the service, and spawned with a shell, then logged into the instance and started the service manually (this worked! o.0)

It would be nice to have a final answer but it isn’t necessary anymore. Thanks for reading this!

What version of Rancher? Before 1.1 it was possible for the entrypoint to run before networking and DNS were fully setup.

Ah hah! That’s it! I’m on 1.0! Thanks Vince!!!

Coming from a 1.0 install of rancher, is it possible to just pull the latest and use it with the existing db?

Yes, exact steps depend on how you have the database configured… for the default (mysql running inside the server container) see

Awesome, yeah I mount a database on the host system, so this upgrade was flawless. Thanks again!