[docker-compose] run entrypoint and more commands

$ cat docker-compose.yml 
        image: composer/composer
        entrypoint: composer require monolog/monolog

$ docker-compose run --rm app composer run-script test
Creating tmp0byzj9nycc_app_run ... done
Could not find package test.
Pick one of these or leave empty to abort:
  [0] pestphp/pest
  [1] behat/behat
  [2] phpunit/phpunit
  [3] brianium/paratest
  [4] phpspec/phpspec
 > [PRESS 0, 1, 2, 3 OR 4 KEY]

In VersionParser.php line 521:
  Could not parse version constraint run-script: Invalid version string "run-script"  

As you can see there is some problem.

First of all, I would like to point out that the composer require monolog/monolog command (entrypoint) was specified in the docker-compose.yml file.
While in the command line we have specified docker-compose to run the composer run-script test command.

But I feel like docker-compose runs everything as one command

composer require monolog/monolog composer run-script test

Basically I would like the entrypoint

composer require monolog/monolog

is executed only when the image (composer/composer) is created, as if it were a sort of initialization command.

And then the user must be free to execute the command he prefers

$ docker-compose run --rm app composer run-script test
$ docker-compose run --rm app composer run-script phpstan
$ docker-compose run --rm app OTHER_COMMAND1
$ docker-compose run --rm app OTHER_COMMAND2
$ docker-compose run --rm app OTHER_COMMAND3

Is it possible?