Merge branch '208_opt_in' of github.com:bboreham/weave into pr234_with_dns
This commit is contained in:
commit
6e8060cb7f
2 files changed
+22
-18
No files matched your search
@@ -6,7 +6,7 @@ usage() {
|
|||||||
echo "weave launch [-password <password>] <peer> ..."
|
echo "weave launch [-password <password>] <peer> ..."
|
||||||
echo "weave launch-dns <cidr>"
|
echo "weave launch-dns <cidr>"
|
||||||
echo "weave connect <peer>"
|
echo "weave connect <peer>"
|
||||||
echo "weave run <cidr> <docker run args> ..."
|
echo "weave run [--with-dns] <cidr> <docker run args> ..."
|
||||||
echo "weave start <cidr> <container_id>"
|
echo "weave start <cidr> <container_id>"
|
||||||
echo "weave attach <cidr> <container_id>"
|
echo "weave attach <cidr> <container_id>"
|
||||||
echo "weave detach <cidr> <container_id>"
|
echo "weave detach <cidr> <container_id>"
|
||||||
@@ -406,21 +406,24 @@ case "$COMMAND" in
|
|||||||
;;
|
;;
|
||||||
run)
|
run)
|
||||||
[ $# -gt 0 ] || usage
|
[ $# -gt 0 ] || usage
|
||||||
|
if [ "$1" = "--with-dns" ] ; then
|
||||||
|
shift 1
|
||||||
|
DNS_ARG=$(docker inspect --format '--dns {{ .NetworkSettings.IPAddress }}'" --link $DNS_CONTAINER_NAME:$DNS_CONTAINER_NAME" $DNS_CONTAINER_NAME 2>/dev/null) || true
|
||||||
|
DNS_SEARCH_ARG="--dns-search=."
|
||||||
|
for arg in $@; do
|
||||||
|
case $arg in
|
||||||
|
--dns-search=*)
|
||||||
|
DNS_SEARCH_ARG=""
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac;
|
||||||
|
done
|
||||||
|
fi
|
||||||
validate_cidr $1
|
validate_cidr $1
|
||||||
CIDR=$1
|
CIDR=$1
|
||||||
shift 1
|
shift 1
|
||||||
create_bridge
|
create_bridge
|
||||||
DNS_ARG=$(docker inspect --format '--dns {{ .NetworkSettings.IPAddress }}'" --link $DNS_CONTAINER_NAME:$DNS_CONTAINER_NAME" $DNS_CONTAINER_NAME 2>/dev/null) || true
|
|
||||||
DNS_SEARCH_ARG="--dns-search=."
|
|
||||||
for arg in $@; do
|
|
||||||
case $arg in
|
|
||||||
--dns-search=*)
|
|
||||||
DNS_SEARCH_ARG=""
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac;
|
|
||||||
done
|
|
||||||
CONTAINER=$(docker run $DNS_ARG $DNS_SEARCH_ARG -d "$@" | tail -n 1)
|
CONTAINER=$(docker run $DNS_ARG $DNS_SEARCH_ARG -d "$@" | tail -n 1)
|
||||||
with_container_netns $CONTAINER attach $CIDR >/dev/null
|
with_container_netns $CONTAINER attach $CIDR >/dev/null
|
||||||
tell_dns PUT $CONTAINER $CIDR
|
tell_dns PUT $CONTAINER $CIDR
|
||||||
|
|||||||
+7
-6
@@ -8,15 +8,16 @@ the host's configured name server.
|
|||||||
|
|
||||||
## Using weaveDNS
|
## Using weaveDNS
|
||||||
|
|
||||||
The weave script command `launch-dns` starts the DNS
|
The weave script command `launch-dns` starts the DNS container, and
|
||||||
container. Subsquently, giving any container a hostname in the domain
|
then you use the `--with-dns` option on containers you wish to use it.
|
||||||
|
Subsquently, giving any container a hostname in the domain
|
||||||
`.weave.local` will register it in DNS. For example:
|
`.weave.local` will register it in DNS. For example:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ weave launch
|
$ weave launch
|
||||||
$ weave launch-dns 10.1.0.2/16
|
$ weave launch-dns 10.1.0.2/16
|
||||||
$ weave run 10.1.1.25/24 -ti -h pingme.weave.local ubuntu
|
$ weave run 10.1.1.25/24 -ti -h pingme.weave.local ubuntu
|
||||||
$ shell1=$(weave run 10.1.1.26/24 -ti -h ubuntu.weave.local ubuntu)
|
$ shell1=$(weave run --with-dns 10.1.1.26/24 -ti -h ubuntu.weave.local ubuntu)
|
||||||
$ docker attach $shell1
|
$ docker attach $shell1
|
||||||
|
|
||||||
# ping pingme
|
# ping pingme
|
||||||
@@ -39,13 +40,13 @@ If you want to supply other entries for the domain search path, you
|
|||||||
will need *also* to supply the `weave.local` domain or subdomain:
|
will need *also* to supply the `weave.local` domain or subdomain:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
weave run 10.1.1.4/24 -ti --dns-search=weave.local --dns-search=local ubuntu
|
weave run --with-dns 10.1.1.4/24 -ti --dns-search=weave.local --dns-search=local ubuntu
|
||||||
```
|
```
|
||||||
|
|
||||||
## Doing things more manually
|
## Doing things more manually
|
||||||
|
|
||||||
If a weaveDNS container is running, `weave run` will automatically
|
If you use the `--with-dns` option, `weave run` will automatically
|
||||||
supply it as the DNS server to the new container. Similarly, both
|
supply the DNS server address to the new container. And both
|
||||||
`weave run` and `weave attach` will register the hostname of the given
|
`weave run` and `weave attach` will register the hostname of the given
|
||||||
container against the given weave network IP address.
|
container against the given weave network IP address.
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user