Adding stream without modifying compose file?
Checklist complete Hello,
Is there any way to add streams without having to add ports to the compose file and relaunch the containers?
This might just be me being a noob at docker, so please just send me a link or a few words to Google if the answers is obvious :)
Short of using host networking (which I wouldn't recommend unless you really know you need it), this is a core function of docker which requires the ports be explicitly published in at startup.
You can, however, publish a range of ports to give yourself a small pool to use inside the container: docker run -p 7000-8000:7000-8000 ...
Just be careful not to publish too big range. From my experience, trying to publish ~50k ports results in very slow startup/shutdown because docker will create or remove iptable rule for each port separately.
like this:
-A DOCKER -d 172.18.0.3/32 ! -i br-87a772e86cc8 -o br-87a772e86cc8 -p tcp -m tcp --dport 54380 -j ACCEPT
-A DOCKER -d 172.18.0.3/32 ! -i br-87a772e86cc8 -o br-87a772e86cc8 -p tcp -m tcp --dport 54379 -j ACCEPT
-A DOCKER -d 172.18.0.3/32 ! -i br-87a772e86cc8 -o br-87a772e86cc8 -p tcp -m tcp --dport 54378 -j ACCEPT
-A DOCKER -d 172.18.0.3/32 ! -i br-87a772e86cc8 -o br-87a772e86cc8 -p tcp -m tcp --dport 54377 -j ACCEPT
-A DOCKER -d 172.18.0.3/32 ! -i br-87a772e86cc8 -o br-87a772e86cc8 -p tcp -m tcp --dport 54376 -j ACCEPT
-A DOCKER -d 172.18.0.3/32 ! -i br-87a772e86cc8 -o br-87a772e86cc8 -p tcp -m tcp --dport 54375 -j ACCEPT
-A DOCKER -d 172.18.0.3/32 ! -i br-87a772e86cc8 -o br-87a772e86cc8 -p tcp -m tcp --dport 54374 -j ACCEPT
-A DOCKER -d 172.18.0.3/32 ! -i br-87a772e86cc8 -o br-87a772e86cc8 -p tcp -m tcp --dport 54373 -j ACCEPT
-A DOCKER -d 172.18.0.3/32 ! -i br-87a772e86cc8 -o br-87a772e86cc8 -p tcp -m tcp --dport 54372 -j ACCEPT
-A DOCKER -d 172.18.0.3/32 ! -i br-87a772e86cc8 -o br-87a772e86cc8 -p tcp -m tcp --dport 54371 -j ACCEPT
etc.
So for me, host networking is better solution, you just need to expose mysqldb to you host (preferably only on 127.0.0.1) and change the DB_MYSQL_HOST variable to local address instead of "db".