Closed bfirsh closed 10 years ago
Hmm 10.10.10.10 will probably broke some entreprise network. We should output a warning on console when we start for the first time. (related to #20 i think)
Yeah. Perhaps we should add hostname support and use a more obscure address in 172.16.0.0/12 or something. Addresses in 192.168.0.0/12 that aren't 192.168.0.0/24 or 192.168.1.0/24 are rarely used too.
Networking! shakes fist
How about this: we use 172.16.42.43 which is unlikely to be used locally, and we add localdocker
to /etc/hosts
to point at that.
For the case where you're on a network where 172.16.42.43 is used, you can set a DOCKER_OSX_IP
environment variable to configure the IP.
Inst Le 31 déc. 2013 17:09, "Ben Firshman" notifications@github.com a écrit :
How about this: we use 172.16.42.43 which is unlikely to be used locally, and we add localdocker to /etc/hosts to point at that.
For the case where you're on a network where 172.16.42.43 is used, you can set a DOCKER_OSX_IP environment variable to configure the IP.
— Reply to this email directly or view it on GitHubhttps://github.com/noplay/docker-osx/pull/19#issuecomment-31400052 .
The environnement variable makes more sense
Maybe the default static IP could be overridden in the extra_config https://github.com/noplay/docker-osx/pull/21
@kumavis That's a good idea.
Right – I've set the address to be 172.16.42.43 (Vagrant picks addresses within 172.16.0.0/16 it seems) and added a localdocker
to /etc/hosts
so you don't have to remember that. @noplay – thoughts?
172.16.42.43 it's better, less conflict possible
Instead of modifying /etc/hosts (you need root permission for that) we can setup a public DNS with that. Something like local.orchardup.com
.
Possibly, although I like the parallels of localdocker
with localhost
. It would seem odd for something local to break if I didn't have a network connection.
Besides, you need root access to install and run VirtualBox – it's not like this is entirely in user space.
+1 host instead of public DNS. ever stuck without internet?
Right, but it can be broken after a system update or by another application (ex: Cisco VPN)
I agree with the point about problems if you don't have network, and it can happen more often than a broken /etc/host.
We can also check at each startup if the host file is valid.
@noplay yep – that's what it does. It checks on every execution. :)
Although this is sort of related to #20 too. I quite like the idea of having an installation function. Then, if stuff breaks, you can run it again (similar to brew doctor
).
@noplay Does this look good? Pretty eager to get the thumbs up – I'm working on a project which I'd like to release tonight which depends on it. :)
:+1:
Can we make the IP configurable via an env variable, similar to the docker version, vagrant cwd, etc?
Also, in the interest of wanting to run multiple docker instances, you do not need to forward the 4243 port when doing this, just configure DOCKER_CMD="$DOCKER_BIN -H=tcp://localdocker:4243"
.
Nevermind, I will formulate a PR since this was just merged.
@mmerickel Good idea. The IP is configurable with a local vagrantfile and manually setting the hosts file (see #21), but it's a bit of a faff. I think I like the idea of an environment variable.
This sort of sucks, because we can't guarantee that 10.10.10.10 (or whatever) won't clobber something on your local network, but I'm not sure what a better solution is.
Ideally we'd also use something like this to set up a
docker
hostname or similar:https://github.com/smdahlen/vagrant-hostmanager
Unfortunately installing Vagrant plugins is slow, which makes this complicated. I'll open a new issue about that.