If the yml
is called docker-compose.yml
it can be launched with a simple $ docker-compose up
. The corresponding attachment of a terminal can be simply (consider that the yml
has specified a service called myservice
):
$ docker-compose exec myservice sh
However, if you are using a different yml
file name, such as docker-compose-mycompose.yml
, it should be launched using $ docker-compose -f docker-compose-mycompose.yml up
. To attach an interactive terminal you have to specify the yml
file too, just like:
$ docker-compose -f docker-compose-mycompose.yml exec myservice sh