Skip to content

Commit

Permalink
Docs and smoke tests for restart command
Browse files Browse the repository at this point in the history
  • Loading branch information
bboreham committed Jul 21, 2015
1 parent 9ec6a8d commit 2c818b4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
24 changes: 24 additions & 0 deletions site/features.md
Expand Up @@ -14,6 +14,7 @@ example](https://github.com/weaveworks/weave#example):
* [Naming and discovery](#naming-and-discovery)
* [Application isolation](#application-isolation)
* [Dynamic network attachment](#dynamic-network-attachment)
* [Restarting containers](#restarting-containers)
* [Security](#security)
* [Host network integration](#host-network-integration)
* [Service export](#service-export)
Expand Down Expand Up @@ -248,6 +249,29 @@ invocation:
host1$ weave detach net:default net:10.2.2.0/24 net:10.2.3.0/24 $C
10.2.1.3 10.2.2.3 10.2.3.1

### <a name="restarting-containers"></a>Restarting containers

If you restart a container, it will retain the same IP addresses on
the weave network:

(assuming `DOCKER_HOST` is pointing at the weave Docker API proxy)

host1$ docker run --name a1 -tdi ubuntu
f76b09a9fcfee04551dbb8d951d9a83e7e7d55126b02fd9f44f9f8a5f07d7c96
host1$ weave ps a1
a1 1e:dc:2a:db:ef:ff 10.32.0.3/12
host1$ docker restart a1
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
Docker API proxy:

host1$ weave restart b1

Note that if Docker restarts a container under a restart policy it
will not be re-attached to the weave network.

### <a name="security"></a>Security

In order to connect containers across untrusted networks, weave peers
Expand Down
3 changes: 3 additions & 0 deletions test/100_cross_hosts_test.sh
Expand Up @@ -27,6 +27,9 @@ start_container $HOST2 net:$SUBNET_2 --name=c6
C6=$(container_ip $HOST2 c6)
assert_raises "exec_on $HOST1 c5 $PING $C6"

weave_on $HOST2 restart c6
assert_raises "exec_on $HOST1 c5 $PING $C6"

# check large packets get through. The first attempt typically fails,
# since the PMTU hasn't been discovered yet. The 2nd attempt should
# succeed.
Expand Down
6 changes: 4 additions & 2 deletions test/640_proxy_restart_reattaches_test.sh
Expand Up @@ -9,11 +9,13 @@ NAME=seetwo.weave.local
start_suite "Proxy restart reattaches networking to containers"

weave_on $HOST1 launch
proxy docker_on $HOST1 run -e WEAVE_CIDR=$C2/24 -dt --name=c2 -h $NAME $SMALL_IMAGE /bin/sh
proxy docker_on $HOST1 run -e WEAVE_CIDR=$C1/24 -dt --name=c1 $DNS_IMAGE /bin/sh
proxy docker_on $HOST1 run -e WEAVE_CIDR="$C2/24 net:default" -dt --name=c2 -h $NAME $SMALL_IMAGE /bin/sh
proxy docker_on $HOST1 run -e WEAVE_CIDR=$C1/24 -dt --name=c1 $DNS_IMAGE /bin/sh

IP2=$(weave_on $HOST1 ps $2 | grep -o -E '10\.[34][0-9]{1,2}\.[0-9]{1,3}\.[0-9]{1,3}')
proxy docker_on $HOST1 restart c2
assert_raises "proxy exec_on $HOST1 c2 $CHECK_ETHWE_UP"
assert_dns_record $HOST1 c1 $NAME $C2
assert_dns_record $HOST1 c1 $NAME $IP2

end_suite

0 comments on commit 2c818b4

Please sign in to comment.