# Redis on the internal subnet

**URL:** <https://forums.suse.com/t/redis-on-the-internal-subnet/3869>\
**Category:** Rancher 1.x\
**Created:** [September 1, 2016, 8:17am UTC](https://forums.suse.com/t/redis-on-the-internal-subnet/3869 "2016-09-01T08:17:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Draper](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/michael_draper/32/1183_2.png) [@Michael\_Draper](https://forums.suse.com/u/Michael_Draper)\
**Post date:** [September 1, 2016, 8:17am UTC](https://forums.suse.com/t/redis-on-the-internal-subnet/3869/1 "2016-09-01T08:17:48Z")

</div>

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 0.0.0.0

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.

---

<div class="post-metadata">

**Author:** ![qulo](https://avatars.discourse-cdn.com/v4/letter/q/ecd19e/32.png) [@qulo](https://forums.suse.com/u/qulo)\
**Post date:** [September 1, 2016, 10:12am UTC](https://forums.suse.com/t/redis-on-the-internal-subnet/3869/2 "2016-09-01T10:12:10Z")

</div>

Have you tried something like this:

```auto
redis:
  image: redis
your-service:
  environment:
    REDIS_IP: redis
  image: docker_image_that_use_redis
  links:
  - redis:redis

```

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

---

<div class="post-metadata">

**Author:** ![Michael\_Draper](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/michael_draper/32/1183_2.png) [@Michael\_Draper](https://forums.suse.com/u/Michael_Draper)\
**Post date:** [September 1, 2016, 8:49pm UTC](https://forums.suse.com/t/redis-on-the-internal-subnet/3869/3 "2016-09-01T20:49:16Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [September 1, 2016, 9:18pm UTC](https://forums.suse.com/t/redis-on-the-internal-subnet/3869/4 "2016-09-01T21:18:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael\_Draper](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/michael_draper/32/1183_2.png) [@Michael\_Draper](https://forums.suse.com/u/Michael_Draper)\
**Post date:** [September 1, 2016, 9:19pm UTC](https://forums.suse.com/t/redis-on-the-internal-subnet/3869/5 "2016-09-01T21:19:49Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [September 1, 2016, 9:54pm UTC](https://forums.suse.com/t/redis-on-the-internal-subnet/3869/6 "2016-09-01T21:54:14Z")

</div>

Yes, exact steps depend on how you have the database configured… for the default (mysql running inside the server container) see [http://docs.rancher.com/rancher/v1.1/en/upgrading/](http://docs.rancher.com/rancher/v1.1/en/upgrading/)

---

<div class="post-metadata">

**Author:** ![Michael\_Draper](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/michael_draper/32/1183_2.png) [@Michael\_Draper](https://forums.suse.com/u/Michael_Draper)\
**Post date:** [September 1, 2016, 10:22pm UTC](https://forums.suse.com/t/redis-on-the-internal-subnet/3869/7 "2016-09-01T22:22:53Z")

</div>

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