Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Make `boot2docker ip` just output IP for easy use in scripts #310
Comments
add an explicit example for adding a Docker daemon parameter
|
So, this is a "clever" one where if you do |
|
Hehe, yes, I didn’t know that! :) Just fixed my scripts. Though after eating stdout, the remaining output is sent to stderr (The VM’s Host only IP address… and the blank lines), which is not very “unixy" - usually stderr is reserved for errors only, which you don’t want to ignore/silence, so it’s a bit disturbing to live with the extra (and incomplete since the IP is “eaten” by stdout) output all the time. Also it’s a bit extraneous and arguably not a very good fit with the terseness / “silence is golden” Unix philosophy “rule": http://homepage.cs.uri.edu/~thenry/resources/unix_art/ch11s09.html I guess it comes down to how well you want to fit into a unix scripting world vs an interactive shell world.
|
|
+1 |
|
Another workaround is to redirect stderr;
|
It's very useful to be able to get the boot2docker VM's IP and use it in scripts (to access docker containers that expose services on the docker host), and though there are two ways to do it now, both are convoluted and fickle:
% DOCKER_IP=
echo $DOCKER_HOST | cut -d: -f2 | cut -c3-boot2docker ip% boot2docker ip
The VM's Host only interface IP address is: 192.168.59.103
This seems like a common use that that could be made much easier:
boot2docker ipjust output the IP address