Automatically running setup for Dockerised InfluxDB?

As part of my current software system, I’m using Docker to create an InfluxDB container via a docker-compose file. However, I can’t find a way to run a setup command (that being a command like setup -o MyOrgName --bucket BucketName --retention...etc) automatically.

I can call the command manually, but if I try to set this setup as a docker command or entrypoint inside my docker-compose file, it will fail as it would have not waited long enough for the container to be initialised before continuing.

Is there a way to perform setup automatically when InfluxDB is dockerised?