FreeNAS 11 + Rancher OS: How to assign IP Addresses to containers?

Status
Not open for further replies.

Sasayaki

Explorer
Joined
Apr 20, 2014
Messages
86
Hi guys,

I'm trying to make Docker work with RancherOS in FreeNAS 11, and while I can get RancherOS running, pulling containers and starting them, I don't know how to assign each container an IP address.

I'm trying to give them IPs in the range 10.0.0.10-20.

I managed to configure the daemon.json file to give the bridge the IP 10.0.0.3, but starting containers doesn't seem to want to work. I can't really find any help about this in the tutorial and it seems like it's a simple step that everyone else's managed to get working but I obviously missed something.

Any suggestions?
 
Last edited by a moderator:

xCatalystx

Contributor
Joined
Dec 3, 2014
Messages
117
Most people will just use the host's ip and map ports rather than giving containers there own IP.

You have a few choices tho.

a) map additional addresses to your rancheros nic, than use -p HOST_IP:HOST_PORT:_CONTAINERPORT
b) make a bridge, configure a new network stack and set the "--fixed-cidr" option in docker network, assign containers to it, bridge the docker network to your nic.
c) create a routing container and route via that or use a reverse proxy.

All of these work in coreos, I would assume for the most part it would work the same in rancheros.
 

xCatalystx

Contributor
Joined
Dec 3, 2014
Messages
117
Using Macvlan is also a decent option.
 

Zwck

Patron
Joined
Oct 27, 2016
Messages
371
I am confused, are you trying to achieve that the container has a specific ip within the docker environment? or that the rest of your outer network sees the container with an outer ip ?

e.g.
Code:
router(inet)							dockerhost ip							 example docker container
192.168.0.1						   192.168.0.100							10.0.0.10-20


or

Code:
router(inet)							dockerhost ip							 example docker container
192.168.0.1						   192.168.0.100							192.168.0.200
 

Sasayaki

Explorer
Joined
Apr 20, 2014
Messages
86
Trying to see that the rest of the network sees the container.

So for example, I can have Sonarr on 192.168.0.10, Radarr on 192.168.0.11, NZBGet on 192.168.0.12, etc.
 

Zwck

Patron
Joined
Oct 27, 2016
Messages
371
Trying to see that the rest of the network sees the container.
So for example, I can have Sonarr on 192.168.0.10, Radarr on 192.168.0.11, NZBGet on 192.168.0.12, etc.

This is probably not the answer you are looking for, but having each container on the host network might not be desired. it's quite a pain to get each container there, and imho its not worth it.

If its only important that the containers can communicate among each other so that you dont have to change the ips everythime a container restarts set it up like this

RancherOS dockerhost -> 192.168.0.16 hostname rancher
Sonarr -> 192.168.0.16:8989 - Set hostname to sonarr (check image in the network tab in the GUI)
Radarr -> 192.168.0.16:7878 - Set hostname to radarr
Sabnzbd -> 192.168.0.16:8080 - Set hostname to sabnzbd

now the containers can communicate among each other just via hostname (regardless of what internal ip they have)

Hostname example tab:
upload_2017-9-12_12-49-21.png

Sonarr example
upload_2017-9-12_12-55-42.png
 

Zwck

Patron
Joined
Oct 27, 2016
Messages
371
Status
Not open for further replies.
Top