oofnikj / docker-openwrt

OpenWrt running in Docker
GNU General Public License v2.0
299 stars 63 forks source link

Feature Request: Provide a sample docker-compose.yml for easier container management #24

Open M0E-lnx opened 3 years ago

M0E-lnx commented 3 years ago

I know docker offers some complex networking options and docker-compose offers a lot of functionality that could be useful to manager this by the docker daemon rather the systemd service file offered here. Unfortunately, I do not know docker or docker-compose well enough create such a complex setup. This would also make it easier to keep persistent data (such as configs) across upgrades.

My particular use case would have something like this:

openwrt-wan: DHCP address from the standard docker bridge network (this is provided by docker, so no config necessary here) openwrt-lan: This would be a static IP that does need to be configured by a network block in docker-compose.yml

The docker-compose management approach would create and tear down the networks as necessary

This may be a helpful starting point: https://runnable.com/docker/docker-compose-networking

oofnikj commented 3 years ago

Hi @M0E-lnx thanks for your suggestion.

I did try at first to implement this project using docker-compose but there are some additional responsibilities handled by the init script (network namespace stuff primarily among them) that cannot be addressed with docker-compose. This would require a wrapper script which only increases the complexity and dependencies of the deployment.

Regarding persistence, there is a doc explaining how to upgrade and preserve config. It's a little bit of a mess because of how OpenWrt handles upgrades in a typical squashfs deployment, but I've performed an upgrade across a couple of versions without issue.

An alternative approach might be to mount /etc/config as a Docker volume, but that would still require some additional steps to address missing packages, configuration file format changes, etc.

hllhll commented 3 years ago

I Also spent some time trying to "composify" the project with no success; I ended up running this first on boot; and executing my compose with other services after this has run.