diff --git a/prog/weaveproxy/main.go b/prog/weaveproxy/main.go
index 836beeb7..4b8f039b 100644
--- a/prog/weaveproxy/main.go
+++ b/prog/weaveproxy/main.go
@@ -13,7 +13,7 @@ import (
var (
version = "(unreleased version)"
defaultDockerAddr = "unix:///var/run/docker.sock"
- defaultListenAddr = ":12375"
+ defaultListenAddr = "tcp://0.0.0.0:12375"
)
func main() {
@@ -29,8 +29,8 @@ func main() {
c.Version = version
getopt.BoolVarLong(&debug, "debug", 'd', "log debugging information")
getopt.BoolVarLong(&justVersion, "version", 0, "print version and exit")
- getopt.StringVar(&c.ListenAddr, 'L', fmt.Sprintf("address on which to listen (default %s)", defaultListenAddr))
- getopt.StringVar(&c.DockerAddr, 'H', fmt.Sprintf("docker daemon URL to proxy (default %s)", defaultDockerAddr))
+ getopt.StringVar(&c.ListenAddr, 'H', fmt.Sprintf("address on which to listen (default %s)", defaultListenAddr))
+ getopt.StringVar(&c.DockerAddr, 'D', fmt.Sprintf("docker daemon URL to proxy (default %s)", defaultDockerAddr))
getopt.StringVarLong(&c.TLSConfig.CACert, "tlscacert", 0, "Trust certs signed only by this CA")
getopt.StringVarLong(&c.TLSConfig.Cert, "tlscert", 0, "Path to TLS certificate file")
getopt.BoolVarLong(&c.TLSConfig.Enabled, "tls", 0, "Use TLS; implied by --tlsverify")
@@ -52,6 +52,16 @@ func main() {
Info.Println("weave proxy", version)
Info.Println("Command line arguments:", strings.Join(os.Args[1:], " "))
+ protoAddrParts := strings.SplitN(c.ListenAddr, "://", 2)
+ if len(protoAddrParts) == 2 {
+ if protoAddrParts[0] != "tcp" {
+ Error.Fatalf("Invalid protocol format: %q", protoAddrParts[0])
+ }
+ c.ListenAddr = protoAddrParts[1]
+ } else {
+ c.ListenAddr = protoAddrParts[0]
+ }
+
p, err := proxy.NewProxy(c)
if err != nil {
Error.Fatalf("Could not start proxy: %s", err)
diff --git a/site/proxy.md b/site/proxy.md
index 1dc35801..bfbe7eef 100644
--- a/site/proxy.md
+++ b/site/proxy.md
@@ -30,14 +30,18 @@ To start the proxy, run
host1$ weave launch-proxy
By default, the proxy will connect to docker at
-`unix:///var/run/docker.sock`. This can be adjusted with the `-H`
+`unix:///var/run/docker.sock`. This can be adjusted with the `-D`
argument, e.g.
- host1$ weave launch-proxy -H tcp://127.0.0.1:4243
+ host1$ weave launch-proxy -D tcp://127.0.0.1:4243
-The proxy listens on port 12375, on all network interfaces. All docker
-commands can be run via the proxy, so it is safe to globally adjust
-your `DOCKER_HOST` to point at the proxy, e.g.
+By default, the proxy listens on port 12375, on all network
+interfaces. This can be adjusted with the `-H` argument, e.g.
+
+ host1$ weave launch-proxy -H tcp://127.0.0.1:9999
+
+All docker commands can be run via the proxy, so it is safe to
+globally adjust your `DOCKER_HOST` to point at the proxy, e.g.
host1$ export DOCKER_HOST=tcp://localhost:12375
host1$ docker ps
@@ -46,7 +50,7 @@ your `DOCKER_HOST` to point at the proxy, e.g.
If you are working with a remote docker daemon, then `localhost` in
the above needs to be replaced with the docker daemon host, and any
firewalls inbetween need to be configured to permit access to
-port 12375.
+the proxy port.
## Usage
diff --git a/weave b/weave
index 26f631cb..68603848 100755
--- a/weave
+++ b/weave
@@ -28,7 +28,7 @@ usage() {
echo "weave launch [-password ] [-nickname ] [-nodiscovery]"
echo " [-iprange ] ..."
echo "weave launch-dns "
- echo "weave launch-proxy [-H ] [--with-dns] [--with-ipam]"
+ echo "weave launch-proxy [-D ] [-H ] [--with-dns] [--with-ipam]"
echo "weave connect [--replace] [ ...]"
echo "weave forget ..."
echo "weave run [--with-dns] [ ...] ..."
@@ -51,6 +51,7 @@ usage() {
echo "where = [:]"
echo " = /"
echo " = or weave internal peer ID"
+ echo " = [tcp://][]:"
exit 1
}
@@ -170,7 +171,6 @@ MTU=65535
PORT=${WEAVE_PORT:-6783}
HTTP_PORT=6784
DNS_HTTP_PORT=6785
-PROXY_PORT=12375
PROXY_CONTAINER_NAME=weaveproxy
@@ -944,7 +944,6 @@ case "$COMMAND" in
# when launching the weaveproxy container.
proxy_args "$@"
PROXY_CONTAINER=$(docker run --privileged -d --name=$PROXY_CONTAINER_NAME --net=host \
- -p $PROXY_PORT:$PROXY_PORT/tcp \
$PROXY_VOLUMES \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /proc:/hostproc \