diff --git a/site/ipam.md b/site/ipam.md
index 74e85090..ebc17589 100644
--- a/site/ipam.md
+++ b/site/ipam.md
@@ -7,7 +7,7 @@ menu_order: 70
Weave Net automatically assigns containers a unique IP address
across the network, and also releases that address when the container
exits. Unless you explicitly specify an address, this occurs for all
-invocations of the `run`, `start`,
+invocations of the
`attach`, `detach`, `expose`, and `hide` commands. Weave Net can also assign
addresses in multiple subnets.
diff --git a/site/using-weave/dynamically-attach-containers.md b/site/using-weave/dynamically-attach-containers.md
index 2e3dc58c..31001a90 100644
--- a/site/using-weave/dynamically-attach-containers.md
+++ b/site/using-weave/dynamically-attach-containers.md
@@ -20,6 +20,22 @@ where,
>Note If you are using the Weave Docker API proxy, it will have modified `DOCKER_HOST` to point to the proxy and therefore you will have to pass `-e WEAVE_CIDR=none` to start a container that _doesn't_ get automatically attached to the weave network for the purposes of this example.
+If `weave attach` sees the container has a hostname with a
+domain-name, it will add those into WeaveDNS (unless you turn this off
+with the `--without-dns` argument).
+
+ host1$ docker run -dti --name=c1 --hostname=c1.weave.local weaveworks/ubuntu
+ host1$ weave attach c1
+ 10.32.0.1
+ host1$ weave dns-lookup c1
+ 10.32.0.1
+
+If you would like `/etc/hosts` to contain the Weave Net address (the
+same way [the proxy does](/site/weave-docker-api/name-resolution-proxy.md)),
+specify `--rewrite-hosts` when running `weave attach`:
+
+ host1$ weave attach --rewrite-hosts c1
+
### Dynamically Detaching Containers
A container can be detached from a subnet, by using the `weave detach` command:
diff --git a/site/weave-docker-api.md b/site/weave-docker-api.md
index a0605c7e..60d616b1 100644
--- a/site/weave-docker-api.md
+++ b/site/weave-docker-api.md
@@ -6,8 +6,7 @@ menu_order: 50
The Docker API proxy automatically attaches containers to the Weave
network when they are started using the ordinary Docker
[command-line interface](https://docs.docker.com/reference/commandline/cli/)
-or the [remote API](https://docs.docker.com/reference/api/docker_remote_api/),
-instead of `weave run`.
+or the [remote API](https://docs.docker.com/reference/api/docker_remote_api/).
### Attaching Containers to a Weave Network
@@ -30,9 +29,9 @@ Note that if a Docker container is started with the --net flag, then the Weave D
is automatically disabled and is not used to attach containers.
See [Integrating Docker via the Network Plugin](/site/plugin.md).
-**3.** Containers can also be attached to the Weave network with `weave run` commands. This method also
+**3.** Containers can also be attached to the Weave network with `weave attach` commands. This method also
does not use the Weave Docker API Proxy.
-See [Launching Containers With Weave Run (without the Proxy)](/site/weave-docker-api/launching-without-proxy.md).
+See [Dynamically Attaching and Detaching Containers](/site/using-weave/dynamically-attach-containers.md).
### Setting Up The Weave Net Docker API Proxy
diff --git a/site/weave-docker-api/launching-without-proxy.md b/site/weave-docker-api/launching-without-proxy.md
index 872eab71..3eaacc10 100644
--- a/site/weave-docker-api/launching-without-proxy.md
+++ b/site/weave-docker-api/launching-without-proxy.md
@@ -3,44 +3,18 @@ title: Launching Containers With Weave Run (without the Proxy)
menu_order: 50
---
+In prior versions of Weave Net, we supported a command `weave run`
+which would run a container and attach it to the Weave Network.
-If you don't want to use the proxy, you can also launch
-containers on to the Weave network using `weave run`:
+This command always had limitations, and now we have Docker plugins
+and the Weave Net Docker API Proxy which do not have those
+limitations, we have removed `weave run`.
- $ weave run -ti weaveworks/ubuntu
+If you have scripts using `weave run`, you can achieve exactly the
+same effect by combining `docker run` and `weave attach`; see
+[Dynamically Attaching and Detaching
+Containers](/site/using-weave/dynamically-attach-containers.md) for
+details.
-The arguments after `run` are passed through to `docker run`. Therefore you
-can freely specify whatever Docker options you need.
-
-Once the container is started, `weave run` attaches it to the Weave network, and in
-this example, it obtains an automatically allocated IP.
-
-You can specify IP addresses manually instead:
-
- $ weave run 10.2.1.1/24 -ti weaveworks/ubuntu
-
-`weave run` rewrites `/etc/hosts` in the same way
-[the proxy does](/site/weave-docker-api/name-resolution-proxy.md). If you need to keep
-the original file, specify `--no-rewrite-hosts` when running
-the container:
-
- $ weave run --no-rewrite-hosts 10.2.1.1/24 -ti weaveworks/ubuntu
-
-There are some limitations to starting containers using `weave run`:
-
-* containers are always started in the background, i.e. the equivalent
- of always supplying the -d option to docker run
-* the --rm option to docker run, for automatically removing containers
- after they stop, is not available
-* the Weave network interface may not be available immediately on
- container startup.
-
-Finally, there is a `weave start` command which starts existing
-containers using `docker start` and attaches them to the Weave network.
-
-
-**See Also**
-
- * [Setting Up The Weave Docker API Proxy](/site/weave-docker-api.md)
- * [Securing Docker Communications With TLS](/site/weave-docker-api/securing-proxy.md)
- * [Name Resolution via `/etc/hosts`](/site/weave-docker-api/name-resolution-proxy.md)
+The `weave start` and `weave restart` commands have also been removed,
+for the same reasons.
diff --git a/site/weave-docker-api/using-proxy.md b/site/weave-docker-api/using-proxy.md
index 46316b38..af81cc85 100644
--- a/site/weave-docker-api/using-proxy.md
+++ b/site/weave-docker-api/using-proxy.md
@@ -64,4 +64,3 @@ route, add the `--no-multicast-route` flag to `weave launch-proxy`.
* [Setting Up The Weave Docker API Proxy](/site/weave-docker-api.md)
* [Securing Docker Communications With TLS](/site/weave-docker-api/securing-proxy.md)
- * [Launching Containers With Weave Run (without the Proxy)](/site/weave-docker-api/launching-without-proxy.md)
diff --git a/site/weavedns.md b/site/weavedns.md
index d9f42eb6..3f211209 100644
--- a/site/weavedns.md
+++ b/site/weavedns.md
@@ -39,7 +39,7 @@ the hostname is not in the weaveDNS domain, the container is *not*
registered, but it will still use weaveDNS for resolution.
To disable an application container's use of weaveDNS, add the
-`--without-dns` option to `weave run` or `weave launch-proxy`. To
+`--without-dns` option to `weave launch-proxy`. To
disable weaveDNS itself, launch weave with the `--no-dns` option.
**See Also**
diff --git a/site/weavedns/how-works-weavedns.md b/site/weavedns/how-works-weavedns.md
index df6a7602..ead210cd 100644
--- a/site/weavedns/how-works-weavedns.md
+++ b/site/weavedns/how-works-weavedns.md
@@ -6,7 +6,7 @@ menu_order: 10
The weaveDNS service running on every host acts as the nameserver for
containers on that host. It learns about hostnames for local containers
-from the proxy and from the `weave run` command.
+from the proxy and from the `weave attach` command.
If a hostname is in the `.weave.local` domain, then weaveDNS records the association of that
name with the container's Weave Net IP address(es) in its in-memory
@@ -37,7 +37,7 @@ In the event that weaveDNS is launched in this way, it's important that
other calls to `weave` also specify the bridge device:
```
-$ sudo DOCKER_BRIDGE=someother weave run ...
+$ sudo DOCKER_BRIDGE=someother weave attach ...
```
**See Also**
diff --git a/site/weavedns/managing-domains-weavedns.md b/site/weavedns/managing-domains-weavedns.md
index 5096d953..24214235 100644
--- a/site/weavedns/managing-domains-weavedns.md
+++ b/site/weavedns/managing-domains-weavedns.md
@@ -11,7 +11,7 @@ The following topics are discussed:
## Configuring the domain search paths
If you don't supply a domain search path (with `--dns-search=`), Weave
-Net (via the [proxy](/site/weave-docker-api.md) or via `weave run`)
+Net (via the [proxy](/site/weave-docker-api.md) or via `weave attach`)
tells a container to look for "bare" hostnames, like `pingme`, in its
own domain (or in `weave.local` if it has no domain).
diff --git a/test/100_cross_hosts_2_test.sh b/test/100_cross_hosts_2_test.sh
index 8ef1fa39..3a713a72 100755
--- a/test/100_cross_hosts_2_test.sh
+++ b/test/100_cross_hosts_2_test.sh
@@ -27,8 +27,9 @@ start_container $HOST2 net:$SUBNET_2 --name=c6
C6=$(container_ip $HOST2 c6)
assert_raises "exec_on $HOST1 c5 $PING $C6"
-# check that restart retains the same IP, and reclaims it in IPAM
-weave_on $HOST2 restart c6
+# check that restart+attach retains the same IP, and reclaims it in IPAM
+docker_on $HOST2 restart c6
+weave_on $HOST2 attach net:$SUBNET_2 c6
assert_raises "exec_on $HOST1 c5 $PING $C6"
# check that restart does not create any additional DNS entry
assert "weave_on $HOST2 report -f \"{{len .DNS.Entries}}\"" "6"
diff --git a/test/140_weave_local_test.sh b/test/140_weave_local_test.sh
index 806db06e..781ebee8 100755
--- a/test/140_weave_local_test.sh
+++ b/test/140_weave_local_test.sh
@@ -15,10 +15,12 @@ weave_local_on $HOST1 reset
weave_local_on $HOST1 launch --ipalloc-range 10.2.5.0/24
assert_raises "docker_on $HOST1 ps | grep weave"
-weave_local_on $HOST1 run 10.2.6.5/24 -ti --name=c1 $SMALL_IMAGE /bin/sh
+docker_on $HOST1 run -dti --name=c1 $SMALL_IMAGE /bin/sh
+weave_local_on $HOST1 attach 10.2.6.5/24 c1
wait_for_attached $HOST1 c1
-weave_local_on $HOST1 run -ti --name=c2 $SMALL_IMAGE /bin/sh
+docker_on $HOST1 run -dti --name=c2 $SMALL_IMAGE /bin/sh
+weave_local_on $HOST1 attach c2
wait_for_attached $HOST1 c2
assert "weave_local_on $HOST1 ps | wc -l" 3
diff --git a/test/195_no_multicast_route_1_test.sh b/test/195_no_multicast_route_1_test.sh
index 740be6d6..dee59b0b 100755
--- a/test/195_no_multicast_route_1_test.sh
+++ b/test/195_no_multicast_route_1_test.sh
@@ -16,7 +16,8 @@ weave_on $HOST1 launch-router
weave_on $HOST1 launch-proxy --no-multicast-route
weave_on $HOST1 launch-plugin # plugin defaults to multicast off except for 'net=weave'
-start_container $HOST1 --no-multicast-route --name c1
+docker_on $HOST1 run --name c1 -dt $SMALL_IMAGE /bin/sh
+weave_on $HOST1 attach --no-multicast-route c1
proxy_start_container $HOST1 --name c2
start_container_local_plugin $HOST1 --name=c3
diff --git a/test/205_dns_disabled_test.sh b/test/205_dns_disabled_test.sh
index 8a4192a9..0c3f319c 100755
--- a/test/205_dns_disabled_test.sh
+++ b/test/205_dns_disabled_test.sh
@@ -12,12 +12,6 @@ assert "weave_on $HOST1 dns-args" ""
C=$(start_container_with_dns $HOST1 $C1/24 --name=c1)
-# hostname is left untouched; equals short container id
-assert "exec_on $HOST1 c1 hostname" $(echo $C | cut -c1-12)
-
-# domainname is left empty
-assert "exec_on $HOST1 c1 dnsdomainname" ""
-
# external name resolution works
assert_raises "exec_on $HOST1 c1 getent hosts www.weave.works"
diff --git a/test/260_dns_removal_test.sh b/test/260_dns_removal_test.sh
index 667f208d..cc521ad8 100755
--- a/test/260_dns_removal_test.sh
+++ b/test/260_dns_removal_test.sh
@@ -26,8 +26,4 @@ docker_on $HOST1 run $DOPTS -dt $SMALL_IMAGE /bin/sh
weave_on $HOST1 attach $C2/24 c2
check
-docker_on $HOST1 create $DOPTS -t $SMALL_IMAGE /bin/sh
-weave_on $HOST1 start $C2/24 c2
-check
-
end_suite
diff --git a/test/270_use_name_as_hostname_test.sh b/test/270_use_name_as_hostname_test.sh
index afb64b1c..285cfe6f 100755
--- a/test/270_use_name_as_hostname_test.sh
+++ b/test/270_use_name_as_hostname_test.sh
@@ -34,8 +34,4 @@ assert_expected_fqdn "$HOSTNAME" -h $HOSTNAME --name=$NAME
assert_expected_fqdn "$HOSTNAME" --hostname=$HOSTNAME --name=$NAME
assert_expected_fqdn "$HOSTNAME" --hostname $HOSTNAME --name=$NAME
-# Ensure we can launch a container with a name that is too long for hostname derivation
-SIXTY_FIVE_CHARS=01234567890123456789012345678901234567890123456789012345678901234
-assert_raises "start_container $HOST1 --name=$SIXTY_FIVE_CHARS"
-
end_suite
diff --git a/test/280_with_or_without_dns_test.sh b/test/280_with_or_without_dns_test.sh
index 1a7e1d4a..206cfd81 100755
--- a/test/280_with_or_without_dns_test.sh
+++ b/test/280_with_or_without_dns_test.sh
@@ -12,7 +12,8 @@ check_dns() {
chk=$1
shift
- container=$(weave_on $HOST1 run $@ $IP/24 -t --add-host=$STATIC:$STATIC_IP $DNS_IMAGE /bin/sh)
+ container=$(docker_on $HOST1 run $(dns_args $HOST1 "$@") -dt $DNS_IMAGE /bin/sh)
+ weave_on $HOST1 attach $IP/24 "$@" --rewrite-hosts --add-host=$STATIC:$STATIC_IP $container
$chk $HOST1 $container $TARGET
assert_dns_record $HOST1 $container $STATIC $STATIC_IP
rm_containers $HOST1 $container
diff --git a/test/500_weave_multi_cidr_test.sh b/test/500_weave_multi_cidr_test.sh
index 6c9d8b5b..fede384f 100755
--- a/test/500_weave_multi_cidr_test.sh
+++ b/test/500_weave_multi_cidr_test.sh
@@ -62,7 +62,7 @@ assert_equal() {
assert "echo $result" "$expected"
}
-start_suite "Weave run/start/attach/detach/expose/hide with multiple cidr arguments"
+start_suite "Weave attach/detach/expose/hide with multiple cidr arguments"
# also check that these commands understand all address flavours
@@ -73,15 +73,8 @@ start_suite "Weave run/start/attach/detach/expose/hide with multiple cidr argume
weave_on $HOST1 launch-router --ipalloc-range 10.2.3.0/24
# Run container with three cidrs
-CID=$(start_container $HOST1 10.2.1.1/24 ip:10.2.2.1/24 net:10.2.3.0/24 --name=multicidr -h $NAME)
-assert_ips_and_dns $HOST1 $CID $NAME. 10.2.1.1/24 10.2.2.1/24 10.2.3.1/24
-
-# Stop the container
-docker_on $HOST1 stop -t 1 $CID
-assert_ips_and_dns $HOST1 $CID $NAME.
-
-# Restart with three IPs
-weave_on $HOST1 start 10.2.1.1/24 ip:10.2.2.1/24 net:10.2.3.0/24 $CID
+CID=$(docker_on $HOST1 run --name=multicidr -h $NAME -dt $SMALL_IMAGE /bin/sh)
+weave_on $HOST1 attach 10.2.1.1/24 ip:10.2.2.1/24 net:10.2.3.0/24 $CID
assert_ips_and_dns $HOST1 $CID $NAME. 10.2.1.1/24 10.2.2.1/24 10.2.3.1/24
# Remove two of them
diff --git a/test/685_proxy_weave_run_test.sh b/test/685_proxy_weave_run_test.sh
deleted file mode 100755
index a7f85673..00000000
--- a/test/685_proxy_weave_run_test.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#! /bin/bash
-
-. "$(dirname "$0")/config.sh"
-
-C1=10.2.1.13
-
-start_suite "Start containers with 'weave run' via proxy"
-
-weave_on $HOST1 launch
-
-proxy start_container $HOST1 $C1/24 --name=c1
-# check we get exactly one IP back, the one specified
-assert "weave_on $HOST1 ps c1 | cut -d ' ' -f 3-" $C1/24
-
-end_suite
diff --git a/test/config.sh b/test/config.sh
index fa6cc4c8..b11973ad 100644
--- a/test/config.sh
+++ b/test/config.sh
@@ -46,6 +46,15 @@ DOCKER_PORT=2375
CHECKPOINT_DISABLE=true
+# The regexp here is far from precise, but good enough. (taken from weave script)
+IP_REGEXP="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
+CIDR_REGEXP="(ip:|net:)?$IP_REGEXP/[0-9]{1,2}"
+
+is_cidr() {
+ [ $1 = "net:default" ] && return
+ echo "$1" | grep -E "^$CIDR_REGEXP$" >/dev/null
+}
+
upload_executable() {
host=$1
file=$2
@@ -140,16 +149,54 @@ exec_on() {
docker -H tcp://$host:$DOCKER_PORT exec $container "$@"
}
+# Look through 'docker run' args and try to make the hostname match the name
+dns_args() {
+ local host=$1 NAME_ARG="" HOSTNAME_SPECIFIED=""
+ shift
+ weave_on $host dns-args "$@"
+ while [ $# -gt 0 ] ; do
+ case "$1" in
+ --name)
+ NAME_ARG="$2"
+ shift
+ ;;
+ --name=*)
+ NAME_ARG="${1#*=}"
+ ;;
+ -h|--hostname|--hostname=*)
+ HOSTNAME_SPECIFIED=1
+ ;;
+ esac
+ shift
+ done
+ if [ -n "$NAME_ARG" -a -z "$HOSTNAME_SPECIFIED" ] ; then
+ echo " --hostname=$NAME_ARG.weave.local"
+ fi
+}
+
+start_container_image() {
+ local image=$1 host=$2 cidr="" weave_dns_args="" container
+ shift 2
+ if [ "$1" = "--without-dns" ] ; then
+ shift
+ else
+ weave_dns_args=$(dns_args $host "$@")
+ fi
+ is_cidr $1 && { cidr=$1; shift; }
+ container=$(docker_on $host run $weave_dns_args $name_args "$@" -dt $image /bin/sh)
+ if ! weave_on $host attach $cidr $container >/dev/null ; then
+ docker_on $host rm -f $container
+ return 1
+ fi
+ echo $container
+}
+
start_container() {
- host=$1
- shift 1
- weave_on $host run "$@" -t $SMALL_IMAGE /bin/sh
+ start_container_image $SMALL_IMAGE "$@"
}
start_container_with_dns() {
- host=$1
- shift 1
- weave_on $host run "$@" -t $DNS_IMAGE /bin/sh
+ start_container_image $DNS_IMAGE "$@"
}
start_container_local_plugin() {
diff --git a/weave b/weave
index 19db8803..cab22dfa 100755
--- a/weave
+++ b/weave
@@ -70,12 +70,9 @@ weave env [--restore]
weave connect [--replace] [ ...]
forget ...
-weave run [--without-dns] [--no-rewrite-hosts] [--no-multicast-route]
- [ ...] ...
- start [ ...]
- attach [ ...]
+weave attach [--without-dns] [--rewrite-hosts] [--no-multicast-route]
+ [ ...]
detach [ ...]
- restart
weave expose [ ...] [-h ]
hide [ ...]
@@ -223,33 +220,6 @@ collect_cidr_args() {
done
}
-dns_arg_count() {
- if [ "$1" = "--with-dns" -o "$1" = "--without-dns" ] ; then
- echo 1
- else
- echo 0
- fi
-}
-
-extra_hosts_args() {
- DNS_EXTRA_HOSTS=
- DNS_EXTRA_HOSTS_ARGS=
- while [ $# -gt 0 ] ; do
- case "$1" in
- --add-host)
- DNS_EXTRA_HOSTS="$2 $DNS_EXTRA_HOSTS"
- DNS_EXTRA_HOSTS_ARGS="--add-host=$2 $DNS_EXTRA_HOSTS_ARGS"
- shift
- ;;
- --add-host=*)
- DNS_EXTRA_HOSTS="${1#*=} $DNS_EXTRA_HOSTS"
- DNS_EXTRA_HOSTS_ARGS="--add-host=${1#*=} $DNS_EXTRA_HOSTS_ARGS"
- ;;
- esac
- shift
- done
-}
-
kill_container() {
docker kill $1 >/dev/null 2>&1 || true
}
@@ -281,46 +251,6 @@ elif [ "$1" = "env" -a "$2" = "--restore" ] ; then
echo "DOCKER_HOST=$ORIG_DOCKER_HOST"
exit 0
fi
-elif [ "$1" = "run" -a -z "$IS_LOCAL" ] ; then
- # non-local "run" is a special case because we want to use docker
- # directly, rather than the docker in $EXEC_IMAGE remotely. That's
- # because we are passing arbitrary arguments on to docker run, and
- # we can't rely on our baked-in docker to support those arguments.
- shift 1
-
- handle_help_arg "$1"
- [ "$1" = "--without-dns" ] || DNS_ARGS=$(exec_remote dns-args "$@" || true)
- shift $(dns_arg_count "$@")
-
- REWRITE_HOSTS=1
- NO_MULTICAST_ROUTE=
- while [ $# -gt 0 ]; do
- case "$1" in
- --no-rewrite-hosts)
- REWRITE_HOSTS=
- ;;
- --no-multicast-route)
- NO_MULTICAST_ROUTE=1
- ;;
- *)
- break
- ;;
- esac
- shift
- done
-
- [ -n "$REWRITE_HOSTS" ] && extra_hosts_args "$@" && DNS_EXTRA_HOSTS_ARGS="--rewrite-hosts $DNS_EXTRA_HOSTS_ARGS"
- [ -n "$NO_MULTICAST_ROUTE" ] && ATTACH_ARGS="--no-multicast-route"
-
- collect_cidr_args "$@"
- shift $CIDR_ARG_COUNT
- CONTAINER=$(docker $DOCKER_CLIENT_ARGS run -e WEAVE_CIDR=none $DNS_ARGS -d "$@")
- if ! exec_remote attach $CIDR_ARGS $DNS_EXTRA_HOSTS_ARGS $ATTACH_ARGS $CONTAINER >/dev/null ; then
- kill_container $CONTAINER
- exit 1
- fi
- echo $CONTAINER
- exit 0
fi
if [ -z "$IS_LOCAL" ] ; then
@@ -822,15 +752,6 @@ destroy_bridge() {
run_iptables -t nat -X WEAVE >/dev/null 2>&1 || true
}
-do_or_die() {
- CONTAINER="$1"
- shift 1
- if ! "$@" ; then
- kill_container $CONTAINER
- exit 1
- fi
-}
-
add_iface_fastdp() {
util_op add-datapath-interface $DATAPATH $1
}
@@ -1371,13 +1292,6 @@ ipam_cidrs() {
done
}
-ipam_cidrs_or_die() {
- if ! ipam_cidrs "$@" ; then
- kill_container $2
- exit 1
- fi
-}
-
show_addrs() {
addrs=
for cidr in "$@" ; do
@@ -2078,34 +1992,10 @@ EOF
call_weave GET /report -H 'Accept: application/json'
fi
;;
- run)
- dns_args "$@"
- shift $(dns_arg_count "$@")
- REWRITE_HOSTS=1
- NO_MULTICAST_ROUTE=
- while [ $# -gt 0 ]; do
- case "$1" in
- --no-rewrite-hosts)
- REWRITE_HOSTS=
- ;;
- --no-multicast-route)
- NO_MULTICAST_ROUTE=1
- ;;
- *)
- break
- ;;
- esac
- shift
- done
- collect_cidr_args "$@"
- shift $CIDR_ARG_COUNT
- CONTAINER=$(docker run -e WEAVE_CIDR=none $DNS_ARGS -d "$@")
- create_bridge
- ipam_cidrs_or_die allocate $CONTAINER $CIDR_ARGS
- [ -n "$REWRITE_HOSTS" ] && extra_hosts_args "$@" && rewrite_etc_hosts $DNS_EXTRA_HOSTS
- do_or_die $CONTAINER attach $ALL_CIDRS
- when_weave_running with_container_fqdn $CONTAINER put_dns_fqdn $ALL_CIDRS
- echo $CONTAINER
+ run|start|restart)
+ echo "The 'weave $COMMAND' command has been removed as of Weave Net version 2.0" >&2
+ echo "Please see release notes for further information" >&2
+ exit 1
;;
dns-args)
dns_args "$@"
@@ -2114,26 +2004,18 @@ EOF
docker-bridge-ip)
util_op bridge-ip $DOCKER_BRIDGE
;;
- start)
- collect_cidr_args "$@"
- shift $CIDR_ARG_COUNT
- [ $# -eq 1 ] || usage
- RES=$(docker start $1)
- CONTAINER=$(container_id $1)
- create_bridge
- ipam_cidrs_or_die allocate $CONTAINER $CIDR_ARGS
- do_or_die $CONTAINER attach $ALL_CIDRS
- when_weave_running with_container_fqdn $CONTAINER put_dns_fqdn $ALL_CIDRS
- echo $RES
- ;;
attach)
DNS_EXTRA_HOSTS=
REWRITE_HOSTS=
NO_MULTICAST_ROUTE=
collect_cidr_args "$@"
shift $CIDR_ARG_COUNT
+ WITHOUT_DNS=
while [ $# -gt 0 ]; do
case "$1" in
+ --without-dns)
+ WITHOUT_DNS=1
+ ;;
--rewrite-hosts)
REWRITE_HOSTS=1
;;
@@ -2159,7 +2041,7 @@ EOF
ipam_cidrs allocate $CONTAINER $CIDR_ARGS
[ -n "$REWRITE_HOSTS" ] && rewrite_etc_hosts $DNS_EXTRA_HOSTS
attach $ALL_CIDRS >/dev/null
- when_weave_running with_container_fqdn $CONTAINER put_dns_fqdn $ALL_CIDRS
+ [ -n "$WITHOUT_DNS" ] || when_weave_running with_container_fqdn $CONTAINER put_dns_fqdn $ALL_CIDRS
show_addrs $ALL_CIDRS
;;
detach)
@@ -2175,20 +2057,6 @@ EOF
done
show_addrs $ALL_CIDRS
;;
- restart)
- [ $# -ge 1 ] || usage
- create_bridge
- ALL_CIDRS=$(with_container_addresses echo_cidrs $1)
- RES=$(docker restart $1)
- CONTAINER=$(container_id $1)
- for CIDR in $ALL_CIDRS ; do
- call_weave PUT /ip/$CONTAINER/$CIDR?check-alive=true
- done
- detect_awsvpc
- do_or_die $CONTAINER attach $ALL_CIDRS
- when_weave_running with_container_fqdn $CONTAINER put_dns_fqdn $ALL_CIDRS
- echo $RES
- ;;
dns-add)
collect_dns_add_remove_args "$@"
FN=put_dns_fqdn