Wait for a weave network to be ready before running a container entrypoint
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



A small binary that waits for a weave network to be connected before running the cli arguments as a command.

Useful when overriding a docker container entrypoint such that the container will wait for the weave network to be ready before running.


wait-for-weave is not designed to be run as a stand alone container.

It is intended to have it's volumes mounted onto another container using --volumes-from.

First - run the wait-for-weave container ensuring you provide a --name parameter and a WAIT_FOR_WEAVE_QUIT=yes environment variable.

$ docker run --name weavewait \
  -e "WAIT_FOR_WEAVE_QUIT=yes" \

The WAIT_FOR_WEAVE_QUIT variable enables us to run the binary but without waiting - otherwise docker complains that we have no given it a command to run.

Then - you can run another container with a --volumes-from=weavewait option.

This enables you change the --entrypoint to /home/weavewait/wait-for-weave.

Pass the original entrypoint as arguments and it will run only once the weave network is up and running:

$ docker run \
    --volumes-from=weavewait \
    --entrypoint="/home/weavewait/wait-for-weave" \
    binocarlos/database-backup /bin/backup.sh --server

In the example above - the containers entrypoint is /bin/backup.sh and the original docker command without wait-for-weave was:

$ docker run binocarlos/database-backup --server

The job of identifying and modifying the container entrypoint and adding the --volumes-from flag is not in the scope of this project. This is much better handled by a docker proxy or similar tool.

exit code

If the ethwe interface is not found within 10 seconds then wait-for-weave will NOT execute the entrypoint, will print a message to stderr and exit with a non-zero exit code.

example usage

The command I ran without weave (where wait-for-weave lived in /srv/projects):

$ docker run \
  -v /srv/projects/wait-for-weave/stage/wait-for-weave:/bin/wait-for-weave \
  --entrypoint="/bin/wait-for-weave" \
  ubuntu bash -c "while true; do echo hello && sleep 1; done"

This printed interface ethwe not found after 10 seconds

The command I ran with weave:

$ sudo weave run \
  -v /srv/projects/wait-for-weave/stage/wait-for-weave:/bin/wait-for-weave \
  --entrypoint="/bin/wait-for-weave" \
  ubuntu bash -c "while true; do echo hello && sleep 1; done"

This printed the container id and when I docker logs $ID it was printing hello lots of times (i.e. it found ethwe and ran the entrypoint)


Copyright 2015 Kai Davenport & Contributors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.