The problem of docker-compose creating redis Cluster

the last step in creating a redis cluster with docker-compose is to use redis-cli to concatenate the started redis nodes, but redis-cli-cluster create has an interactive process (you need to enter "yes"). How to accomplish this whole operation in docker-compose?
redis-cli service configuration in compose:

  redis-cli:
    image: redis:5.0.1-alpine
    depends_on:
      - redis1
      - redis2
      - redis3
      - redis4
      - redis5
      - redis6
    links:
      - redis1
      - redis2
      - redis3
      - redis4
      - redis5
      - redis6
    entrypoint:
      - redis-cli
      - --cluster
      - create
      - redis1:${client_port}
      - redis2:${client_port}
      - redis3:${client_port}
      - redis4:${client_port}
      - redis5:${client_port}
      - redis6:${client_port}
      - --cluster-replicas
      - "1"
      - -a
      - ${client_pwd}

then comes the interactive prompt that appears after startup:

Attaching to redis-cluster_redis-cli_1_99db7133d585
redis-cli_1_99db7133d585 | Warning: Using a password with "-a" or "-u" option on the command line interface may not be safe.
redis-cli_1_99db7133d585 | >>> Performing hash slots allocation on 6 nodes...
redis-cli_1_99db7133d585 | Master[0] -> Slots 0 - 5460
redis-cli_1_99db7133d585 | Master[1] -> Slots 5461 - 10922
redis-cli_1_99db7133d585 | Master[2] -> Slots 10923 - 16383
redis-cli_1_99db7133d585 | Adding replica redis4:6379 to redis1:6379
redis-cli_1_99db7133d585 | Adding replica redis5:6379 to redis2:6379
redis-cli_1_99db7133d585 | Adding replica redis6:6379 to redis3:6379
redis-cli_1_99db7133d585 | M: 3193369a87bdd75dec82dae302bfc703962b029f redis1:6379
redis-cli_1_99db7133d585 |    slots:[0-5460] (5461 slots) master
redis-cli_1_99db7133d585 | M: a9085988e16f91ecb4ac37e39fb360b90f5f16bc redis2:6379
redis-cli_1_99db7133d585 |    slots:[5461-10922] (5462 slots) master
redis-cli_1_99db7133d585 | M: 3e71facdb786284e5b4c65e396c72a1a2e08aff8 redis3:6379
redis-cli_1_99db7133d585 |    slots:[10923-16383] (5461 slots) master
redis-cli_1_99db7133d585 | S: 0c8070d7dc8cd6288a7cd4495fb860a4190b0f54 redis4:6379
redis-cli_1_99db7133d585 |    replicates 3193369a87bdd75dec82dae302bfc703962b029f
redis-cli_1_99db7133d585 | S: 8aa17809f2e74f8bb91ac0e5d14aa810036ccde7 redis5:6379
redis-cli_1_99db7133d585 |    replicates a9085988e16f91ecb4ac37e39fb360b90f5f16bc
redis-cli_1_99db7133d585 | S: 3fed12ec7f67d6cd14b873155d3d956c0317bf39 redis6:6379
redis-cli_1_99db7133d585 |    replicates 3e71facdb786284e5b4c65e396c72a1a2e08aff8
redis-cli_1_99db7133d585 | Can I set the above configuration? (type "yes" to accept): redis-cluster_redis-cli_1_99db7133d585 exited with code 0

finally, you need to enter a yes interactively, and as a result, the container exits

May.10,2022

-sharp!/bin/sh

echo "yes" | redis-cli --cluster create `ping redis1 -c1 | sed '1{s/[^(]*(//;s/).*//;q}'`:$CLIENT_PORT \
    `ping redis2 -c1 | sed '1{s/[^(]*(//;s/).*//;q}'`:$CLIENT_PORT \
    `ping redis3 -c1 | sed '1{s/[^(]*(//;s/).*//;q}'`:$CLIENT_PORT \
    `ping redis4 -c1 | sed '1{s/[^(]*(//;s/).*//;q}'`:$CLIENT_PORT \
    `ping redis5 -c1 | sed '1{s/[^(]*(//;s/).*//;q}'`:$CLIENT_PORT \
    `ping redis6 -c1 | sed '1{s/[^(]*(//;s/).*//;q}'`:$CLIENT_PORT \
    --cluster-replicas "1" -a $CLIENT_PWD
tail -f /dev/null
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b9e833-2f3ed.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b9e833-2f3ed.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?