Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mangalbhaskar/ab1587521a41a8e648c2b9dcbdc8cffd to your computer and use it in GitHub Desktop.
Save mangalbhaskar/ab1587521a41a8e648c2b9dcbdc8cffd to your computer and use it in GitHub Desktop.

How To Change The Default Docker Engine Ip

  1. Inspect system IP and docker network. Use sudo if you are getting permission denied error, ex: sudo docker network list
    ip a
    docker network list
    # docker network inspect etc_default | grep Subnet
    docker network inspect bridge
  2. Create file /etc/docker/daemon.json if it does not already exits
    sudo vi /etc/docker/daemon.json
    • Provide the required IP details and following details
      {
        "live-restore": true,
        "bip": "172.17.0.1/24",
        "default-address-pools": [{
          "base": "172.17.0.1/24",
          "size": 24
        }]
      }
  3. CAUTION: DO NOT run this if you are not sure what it does Cleanup existing container, images and network. Skip this step, and run this only if things are not working;
    ## Delete all running docker containers:
    docker rm -f `docker ps -q -a`
    ## Delete all unused Docker objects:
    docker system prune
    docker network prune
  4. Restart docker service
    sudo systemctl restart docker

For more details, look into the provided references.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment