Jump to content

Docker (software): Difference between revisions

Line 184: Line 184:
* You do not need to add <code>expose</code>.
* You do not need to add <code>expose</code>.


By default, netoworks are allocated with ip ranges:
* 172.17.0.0/12 with size /16
* 192.168.0.0/16 with size /20
If you want this to be more consistent, you can change it as follows:
Set the following in <code>/etc/docker/daemon.json</code>:
Set the following in <code>/etc/docker/daemon.json</code>:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
Line 193: Line 197:
</syntaxhighlight>
</syntaxhighlight>
Then restart your docker: <code>sudo systemctl restart docker</code> and prune networks <code>docker network prune</code>.<br>
Then restart your docker: <code>sudo systemctl restart docker</code> and prune networks <code>docker network prune</code>.<br>
This will force docker to assign subnets from 172.16.0.0/24 to 172.32.255.0/24 instead of 172.16.0.0/12 to 172.32.0.0/12.<br>
Thus it won't overflow to 192.168.0.0/24.<br>
Next, in your firewall, allow connections to your localhost from 172.16.0.0/12.
Next, in your firewall, allow connections to your localhost from 172.16.0.0/12.
<pre>
<pre>