p8952 / bocker

Docker implemented in around 100 lines of bash
https://www.p8952.info/
GNU General Public License v3.0
11.26k stars 715 forks source link

All 'containers' have the same IP #3

Closed ccope closed 9 years ago

ccope commented 9 years ago

This would prevent you from running two webservers on port 80, for instance. If doing dhcp isn't possible, the next best thing would be to maintain a list of currently used IPs.

p8952 commented 9 years ago

You're right.

Ideally I don't want to have to keep track of state, or run a DHCP server.

I think the best way to deal with this is to have unique IP and MAC addresses deterministically generated from the container IDs.

ccope commented 9 years ago

Yeah, I was thinking about that. You could try generating them sequentially, but if you need to wrap (there are only ~250 addresses in the default bridge network) then you have to check which addresses are free.

p8952 commented 9 years ago

It looks like I need to solve or at least work around #10 before fixing this. Currently there are 89999 possible UUIDs so conflicts are fairly rare.

If we go for deterministically generated IPs and limit ourselves to a maximum of 253 containers (a fair limit imo) the odds of conflicts go way up.