Docker Para Mac Gateway IP

четверг 07 маяadmin

It is almost the first thing in the Netwoking chapter of the Docker for Mac documentation: I WANT TO. The host has a changing IP address (or none if you have no network access). The gateway is also reachable as gateway.docker.internal. Docker automatically creates a subnet and gateway for the bridge network, and docker run automatically adds containers to it. If you have containers running on your network, docker network inspect displays networking information for your containers. Any containers on the same network may communicate with one another via IP addresses.

Article ID: KB000299

Issue

The docker_gwbridge interface provides default gateway functionality for allcontainers and tasks which use a multi-host swarm overlay network. It is createdon each Docker host when it joins a swarm cluster.

If the IP address of the interface docker_gwbridge conflicts with an addresson your network, it can be changed on a host-by-host basis.

Prerequisites

  • Docker swarm mode cluster

Resolution

Warning: Modifying an existing member of a cluster involves stopping all swarm overlay attached containers on the host.

To alter the subnet of docker_gwbridge, stop any classic containers attachedto overlay networks, drain the node or leave the swarm, remove the network,re-add it with the desired subnet, and restart classic containers as follows(must be done on a host-by-host basis):

  1. Save a list of any overlay-attached classic containers. This will be used tostop and start these containers before and after network reconfiguration.

  2. Stop any classic containers using docker_gwbridge. Gamerival gold miner. Classic containerswill not be rescheduled to other nodes.

  3. Stop swarm tasks and disable swarm multi-host overlay networking on the nodeby draining the node. Swarm service tasks will be rescheduled to other nodesif their constraints and resource limits allow. Drain the node using the UCPWebUI, or an administrative UCP client certificate bundle:

  4. Disconnect the ingress-sbox endpoint from the docker_gwbridge network,then remove the network itself:

  5. Engine versions 18.09 and later enable local IPAM configuration via thedefault-address-pools daemon config. On Engine 18.09 and later, edit orcreate /etc/docker/daemon.json, populating default-address-pools with thelist of preferred pools and network sizes. If this file is empty or does notexist prior to editing, it should look like this when finished:

    Then restart the engine to pick up the new settings:

    On Engine versions 18.03 and earlier where default-address-pools is notavailable, recreate the docker_gwbridge with default inter-containercommunication settings and interface name as well as the desired subnetconfiguration:

  6. (Optional) Confirm the settings on docker_gwbridge:

  7. Re-enable swarm multi-host overlay by setting node availability to active.Use the UCP WebUI or an administrative client certificate bundle to set itsavailability back to active

  8. Restart any overlay-attached classic containers:

What's Next

  • Plan your UCP installation naming and address considerations at docs.docker.com