Protect against Docker hanging trying to talk to a non-existent plugin
Remove the Unix socket from the filesystem before doing volume operations, if the plugin is not running.
This commit is contained in:
1 parent
6c7f860418
commit
bc79a9187f
1 file changed
+9
@@ -1740,6 +1740,7 @@ launch_router() {
|
||||
|
||||
# Create a data-only container for persistence data
|
||||
if ! docker inspect -f ' ' $DB_CONTAINER_NAME > /dev/null 2>&1 ; then
|
||||
protect_against_docker_hang
|
||||
docker create -v /weavedb --name=$DB_CONTAINER_NAME \
|
||||
--label=weavevolumes $WEAVEDB_IMAGE >/dev/null
|
||||
fi
|
||||
@@ -1803,6 +1804,7 @@ launch_proxy() {
|
||||
mkdir -p /var/run/weave
|
||||
# Create a data-only container to mount the weavewait files from
|
||||
if ! docker inspect -f ' ' $VOLUMES_CONTAINER_NAME > /dev/null 2>&1 ; then
|
||||
protect_against_docker_hang
|
||||
docker create -v /w -v /w-noop -v /w-nomcast --name=$VOLUMES_CONTAINER_NAME \
|
||||
--label=weavevolumes --entrypoint=/bin/false $EXEC_IMAGE >/dev/null
|
||||
fi
|
||||
@@ -1864,6 +1866,13 @@ stop_plugin() {
|
||||
stop $PLUGIN_CONTAINER_NAME "Plugin"
|
||||
}
|
||||
|
||||
protect_against_docker_hang() {
|
||||
# If the plugin is not running, remove its socket so Docker doesn't try to talk to it
|
||||
if !check_running $PLUGIN_CONTAINER_NAME 2>/dev/null ; then
|
||||
rm -f /run/docker/plugins/weave.sock /run/docker/plugins/weavemesh.sock
|
||||
fi
|
||||
}
|
||||
|
||||
##########################################################################################
|
||||
|
||||
[ $(id -u) = 0 ] || {
|
||||
|
||||
Reference in new issue
Block a user