用官方方案https://docs.docker.com/compose/startup-order/
下载wait-for-it.sh https://github.com/vishnubob/wait-for-it
别忘了在主机上设置一下可执行
chmod +x ./wait-for-it.sh
不然
ERROR: for db_json Cannot start service db_json: OCI runtime create failed: container_linux.go:: starting container process caused "exec: \"/wait-for-it.sh\": permission denied": unknown