Skip to content

Commit 04d83c0

Browse files
authored
[docker_image_ctl.j2]: swss docker initialization improvements (sonic-net#17628) (sonic-net#17681)
1 parent 78c8f11 commit 04d83c0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

files/build_templates/docker_image_ctl.j2

+9
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,12 @@ function postStartAction()
283283
fi
284284
chgrp -f redis $REDIS_SOCK && chmod -f 0760 $REDIS_SOCK
285285
{%- elif docker_container_name == "swss" %}
286+
# Wait until swss container state is Running
287+
until [[ ($(docker inspect -f {{"'{{.State.Running}}'"}} swss$DEV) == "true") ]]; do
288+
sleep 0.1
289+
done
290+
echo "swss container is up and running"
291+
286292
docker exec swss$DEV rm -f /ready # remove cruft
287293
if [[ "$BOOT_TYPE" == "fast" ]] && [[ -d /host/fast-reboot ]]; then
288294
test -e /host/fast-reboot/fdb.json && docker cp /host/fast-reboot/fdb.json swss$DEV:/
@@ -292,6 +298,9 @@ function postStartAction()
292298
rm -fr /host/fast-reboot
293299
fi
294300
docker exec swss$DEV touch /ready # signal swssconfig.sh to go
301+
# Re-confirm that file is indeed created and log an error if not
302+
docker exec swss$DEV test -f /ready && echo "File swss:/ready created" || echo "Error: File swss:/ready doesn't exist"
303+
295304
{%- elif docker_container_name == "pmon" %}
296305

297306
DEVPATH="/usr/share/sonic/device"

0 commit comments

Comments
 (0)