File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -92,14 +92,35 @@ wait_for_stack_to_be_ready() {
92
92
current_state=$( echo " ${line} " | jq -r ' .CurrentState' )
93
93
desired_state=$( echo " ${line} " | jq -r ' .DesiredState' )
94
94
95
+ service_error=$( echo " ${line} " | jq -r ' .Error' )
96
+
95
97
if [[ ${current_state} == Running* ]] && [[ ${desired_state} == " Running" ]]; then
96
98
service_running=true
97
99
break
98
100
fi
101
+
102
+ if [[ ${service_error} != " " ]]; then
103
+ break
104
+ fi
99
105
done < <( echo " ${service_info} " )
100
106
101
107
if [[ ${service_running} == true ]]; then
102
108
break
109
+ elif [[ ${service_error} == " network sandbox join failed: subnet sandbox" * ]]; then
110
+ local number_of_interfaces
111
+ number_of_interfaces=$( execute_sudo " ip -d link show | grep vx | wc -l" )
112
+ if [[ number_of_interfaces -eq 1 ]]; then
113
+ echo " Docker has a network interface that is lingering and preventing startup. We'll attempt to auto-delete it."
114
+ execute_sudo " ip -d link show | grep vx | grep DOWN | xargs -rn1 ip link delete"
115
+ # shellcheck disable=SC2181
116
+ if [[ $? -ne 0 ]]; then
117
+ echo " Docker swarm is unable to start services. https://github.com/moby/libnetwork/issues/1765"
118
+ abort " Exiting the program."
119
+ fi
120
+ elif [[ number_of_interfaces -gt 1 ]]; then
121
+ echo " Docker swarm is unable to start services. https://github.com/moby/libnetwork/issues/1765"
122
+ abort " Multiple vx interfaces found. Please delete all vx interfaces or reboot the server"
123
+ fi
103
124
else
104
125
echo " Waiting for stack to be ready..."
105
126
sleep 2
You can’t perform that action at this time.
0 commit comments