diff --git a/site/features.md b/site/features.md
index 9a0074ac..02a8b2a4 100644
--- a/site/features.md
+++ b/site/features.md
@@ -167,6 +167,11 @@ the weave network:
host1$ weave ps a1
a1 16:c0:6f:5d:c5:73 10.32.0.3/12
+There is also a `weave restart` command, if you are not using the
+weave Docker API proxy:
+
+ host1$ weave restart b1
+
(note that the IP address is held for a limited time - currently five seconds)
### Naming and discovery
diff --git a/test/100_cross_hosts_2_test.sh b/test/100_cross_hosts_2_test.sh
index 4ea28f74..203cb0b2 100755
--- a/test/100_cross_hosts_2_test.sh
+++ b/test/100_cross_hosts_2_test.sh
@@ -27,4 +27,12 @@ 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
+assert_raises "exec_on $HOST1 c5 $PING $C6"
+sleep 6 # past the IPAM timeout
+start_container $HOST2 net:$SUBNET_2 --name=c7
+C7=$(container_ip $HOST2 c7)
+assert_raises "[ $C6 != $C7 ]"
+
end_suite
diff --git a/weave b/weave
index 3f5f3d87..65172f01 100755
--- a/weave
+++ b/weave
@@ -63,6 +63,7 @@ weave run [--without-dns] [--no-rewrite-hosts] [--no-multicast-route]
start [ ...]
attach [ ...]
detach [ ...]
+ restart
weave expose [ ...] [-h ]
hide [ ...]
@@ -1045,6 +1046,10 @@ echo_ips() {
done
}
+echo_cidrs() {
+ echo $3
+}
+
peer_args() {
res=''
sep=''
@@ -2026,6 +2031,15 @@ EOF
done
show_addrs $ALL_CIDRS
;;
+ restart)
+ [ $# -ge 1 ] || usage
+ create_bridge
+ ALL_CIDRS=$(with_container_addresses echo_cidrs $1)
+ RES=$(docker restart "$1")
+ with_container_netns_or_die $1 attach $ALL_CIDRS
+ when_weave_running with_container_fqdn $1 put_dns_fqdn $ALL_CIDRS
+ echo $RES
+ ;;
dns-add)
collect_dns_add_remove_args "$@"
FN=put_dns_fqdn