Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Machine network error on public network

I have an issue where I'm unable to start any docker machines whilst connected to a the WiFi network in my local Starbucks, receiving the following output;

$ docker-machine start
Starting "default"...
(default) Check network to re-create if needed...
Error setting up host only network on machine start: host-only cidr conflicts with the network address of a host interface

This does not happen when connected to my home network, or whilst using my mobile hotspot. Is there any workaround for this?

like image 596
James Crinkley Avatar asked Mar 16 '18 17:03

James Crinkley


People also ask

Can Docker containers access local network?

docker run --network="host" Alternatively you can run a docker container with network settings set to host . Such a container will share the network stack with the docker host and from the container point of view, localhost (or 127.0. 0.1 ) will refer to the docker host.

Can a docker container connect to multiple networks?

You can create multiple networks with Docker and add containers to one or more networks. Containers can communicate within networks but not across networks. A container with attachments to multiple networks can connect with all of the containers on all of those networks.


2 Answers

There is a collision between the docker machine and the network that is being set up for wifi. Try creating a new docker machine with other ip:

docker-machine create --driver virtualbox --virtualbox-hostonly-cidr "192.168.123.99/24" mymachine

Use it:

docker-machine env mymachine

This is a new machine in addition to the 'default' one. You might see that it won't have your previous work (images, etc).

like image 121
Robert Avatar answered Oct 18 '22 20:10

Robert


Your docker-machine start failed. So either you create new VM or repair existing VM.

  1. For new VM option, use --virtualbox-hostonly-cidr "10.10.10.1/24" (replace 10.10.10.1/24 with whatever subnet you want VM to use.)

  2. For already created VM(start failed), bring up the virtual box UI and change it in the network preferences. Use docker-machine ls to list existing VMs.

like image 44
Swati Avatar answered Oct 18 '22 20:10

Swati