Unable to access local network IP from docker container

后端 未结 4 785
生来不讨喜
生来不讨喜 2021-02-05 21:35

Running macOS and docker ubuntu on it, I am unable to ping my local network\'s IP addresses. Below is the network configuration of my docker container. I can ping my host machin

4条回答
  •  半阙折子戏
    2021-02-05 22:05

    I think docker internal network could be conflicting with your local network addressing.

    Try to run Docker changing the default internal network to something that doesn't conflict, as 172.31.0.0/24. Add to your Docker startup options --bip 172.31.0.1/24, probably located in /etc/default/docker:

    # Use DOCKER_OPTS to modify the daemon startup options.
    DOCKER_OPTS="--bip 172.31.0.1/24"
    

    UPDATE: Although this is true in Linux, Mac implementation is different, see docs here, so it depends if you're using Docker for Mac or for Linux.

    Just to test, try to attach your laptop to a different network, any in the range of 192.168.0.0/16 would suffice.

提交回复
热议问题