OpenMediaVault-Plugin-Developers / openmediavault-docker-gui

Docker plugin for OpenMediaVault
32 stars 17 forks source link

Port forwards are reset when custom network bridge is used #68

Open godfuture opened 6 years ago

godfuture commented 6 years ago

I want to use the docker host names to resolve with their docker IP address when being used inside a container, as I didn't figure out how to easily assign fixed IPs.

Example: You have a mysql container named "mysql" and you have another container trying to reach the mysql database. The IP assigned to the mysql container is not fixed and may change during restarts. Therefore I want to use the docker host names which are less often changed.

Well, it seems that docker supports this, but only if you create your own bridge. The default bridge does not resolve the host names.

I tried it out and it seems that docker does resolve names on custom bridges (somehow their docker name and not the host name). Nevertheless, there is an issue when using "--network=mycustombridge" option. The modify editor opens the container with "network mode" = mycustombridge. When I save the dialog, all port forwards are reset. First I have to switch the network mode back to "Bridge" and after that save the modify dialog normally.

I guess this is a bug. "mycustombridge" does not appear in the list of values for network mode, even being selected once using the --network=mycustombridge option.

subzero79 commented 6 years ago

Not sure to add more features now. Omv4 is marked as stable. The link flag still works for what you want but we don’t know when is going to be removed (as is marked as legacy by docker ).

godfuture commented 6 years ago

I guess besides host name resolving there might be also different reasons users add a new bridge. Depending how you want to build up the virtual network, you even need a new bridge. And as you say, the link is not the way to go...

subzero79 commented 6 years ago

Yes I know. We added macvlan first as in some scenarios was more practical. About the link I just found out two months ago being marked as to be removed soon. If you want to mimic the code behind macvlan and submit a pr for bridge I am happy to test it here, other members of extras can do also. If you really need this then I recommend you to use portainer until we can add this feature.