Docker 101 : Error response from daemon: container cannot be connected to multiple networks with one of the networks in private (none) mode


Creating a new docker network:

We create a new network u called "new-net" using the below command:


It created a bridge network, as it is the default one. We check the creation of the new network "new-net"using:



Running containers:



We can see the ID and the name of the running container above.

Connecting the container to a network:


We can connect a running container with the ID (73310e25a065) to the network "new-net" using :


But when we try to connect to the "new-net" network, we receive the below error:

Error response from daemon: container cannot be connected to multiple networks with one of the networks in private (none) mode

To solve the issue, we need to disconnect the container (73310e25a065
) from the "none" network that we can see in the list of docker networks in the above output from the command 
(docker network ls):


Then we can connect the container (73310e25a065) again to the "new-net" network:


To check if the container (73310e25a065) is connected to the network "new-net", we use the below command:


We can see the container (73310e25a065) in the network details below:



Comments

Leave as a comment:

Archive