How to run docker-compose on host from within container

I’m looking at an action that is made in a nodejs process inside a Docker container (let’s call this the tester), the action being “run n containers (let’s call these containers slaves) of a specific image”. I don’t know until runtime exactly how many n slaves need to be run, n depends on a configuration provided by an authenticated (to my SaaS) user (the build user).

Is it possible to run from within a container (tester) a lambda function on my host which runs docker-compose on the host, thus running a number of services/containers (slaves) on the host? The tester doesn’t know how many slaves it needs until run time.

Prod workflow (in the cloud, probably AWS)

Execute serverless or just run lambda directly (not sure) from within the tester container, which will run the lambda function, which runs an ECS task, which runs n slave containers

Dev workflow (on local dev machine)

Execute serverless offline from within the tester container, which will run the lambda function, which runs docker-compose, which runs n slave containers