5,337
edits
(→Images) |
(→bridge) |
||
Line 81: | Line 81: | ||
In bridge mode, the docker service acts as a NAT and gives each container a separate local IP along with the docker host. | In bridge mode, the docker service acts as a NAT and gives each container a separate local IP along with the docker host. | ||
On linux, you can type <code>ip a</code> to see the ip address of the <code>docker0</code> network interface. | On linux, you can type <code>ip a</code> to see the ip address of the <code>docker0</code> network interface. | ||
On my server, it is <code>172.17.0.1/16</code>. | On my server, it is <code>172.17.0.1/16</code>. | ||
To access services running on the host (such as MySQL or Postgres), you will need to make these services | |||
To access services running on the host (such as MySQL or Postgres), you will need to make these services listen on this network interface and allow it through your firewall. I suggest using [https://github.com/qoomon/docker-host qoomon/docker-host] which can redirect network traffic to the host. | |||
When using docker-compose, services can access each other using their service name as the hostname. However, the port needs to be exposed in the compose file. | |||
===host=== | ===host=== |