You can run a command in a container:
docker-compose run <container name> <command>
For example, to get a shell into your web container you might run
docker-compose run web /bin/bash
To run a series of commands, you must wrap them in a single command using a shell. For example:
docker-compose run <name in yml> sh -c '<command 1> && <command 2> && <command 3>'