diff --git a/dockers/docker-database/docker-database-init.sh b/dockers/docker-database/docker-database-init.sh index 30a65af89b..139815924f 100755 --- a/dockers/docker-database/docker-database-init.sh +++ b/dockers/docker-database/docker-database-init.sh @@ -50,8 +50,6 @@ if [[ $DATABASE_TYPE == "chassisdb" ]]; then # Docker init for database-chassis echo "Init docker-database-chassis..." update_chassisdb_config -j $db_cfg_file_tmp -k -p $chassis_db_port - mkdir -p /var/run/redis/sonic-db - cp /etc/default/sonic-db/database_config.json /var/run/redis/sonic-db # generate all redis server supervisord configuration file sonic-cfggen -j $db_cfg_file_tmp -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf rm $db_cfg_file_tmp diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 477fd897bf..dc714e5b5c 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -144,6 +144,10 @@ function postStartAction() # Add redis UDS to the redis group and give read/write access to the group REDIS_SOCK="/var/run/redis${DEV}/redis.sock" else + until [[ ($(docker exec -i ${DOCKERNAME} pgrep -x -c supervisord) -gt 0) && + ($(docker exec -i ${DOCKERNAME} $SONIC_DB_CLI CHASSIS_APP_DB PING | grep -c True) -gt 0) ]]; do + sleep 1 + done REDIS_SOCK="/var/run/redis-chassis/redis_chassis.sock" fi chgrp -f redis $REDIS_SOCK && chmod -f 0760 $REDIS_SOCK