How Do You Troubleshoot the Docker Error “User specified IP address is supported on user defined networks only”?

Problem scenario
When using a "docker run" command you get this error: "Error response from daemon: User specified IP address is supported on user defined networks only."  What do you do to create a user-defined network?

#1  From the Linux server (the Docker host), run this command:  ip addr show

#2  Look at the results for eth0.  Find its "inet" IP address and subnet mask (e.g., This is the internal IP address of the Docker server and its subnet mask in shorthand notation.  To determine the IP address of this Docker network you will create, mentally increment the last octet's integer value by 1 and keep the subnet mask for the construction of a command below.  If the octet (after incrementing it) is above 255, find an addressable IP number not being used and within the subnet mask for the server's IP address.

#3  Run a command like the following emboldened command, however you may want to substitute "isolated_nw1" with the name of your choice for this user-defined network.  You must substitute x.x.x.x in the draft of the command below with the IP address this network will have (possibly as simple as one greater than the last octet of the server's internal IP address).  You will likely substitute 20 with the subnet mask short hand notation that the server's internal IP address has.

docker network create --driver bridge isolated_nw1 --subnet x.x.x.x/20

The result may look like this:

docker network create --driver bridge isolated_nw1 --subnet

Take a note of this IP address and mentally increment the last octet one more time.  You'll use that [incremented] IP address later for a Docker container.  But that should fix the problem of not having a Docker user-defined network.

If you are interested in networking containers, you may want to read a short posting about Flannel or Calico.

Leave a comment

Your email address will not be published. Required fields are marked *