For anyone else who came here looking to do the same with docker-compose
you just need to prepend bash -c
and enclose multiple commands in quotes, joined together with &&
.
So in the OPs example docker-compose run image bash -c "cd /path/to/somewhere && python a.py"