Reputation: 53920
I have read https://docs.docker.com/compose/reference/run/, and I found that I can run a single service like web
service here:
docker-compose run web
Can I run in a single line two or more services like this?
docker-compose run web, backup
Upvotes: 16
Views: 23400
Reputation: 13489
Currently docker-compose run
does not allow specifying multiple services, and there aren't any plans to do so either due to the way docker-compose run
is designed.
There are other ways to achieve a similar result:
depends_on
directive to specify that the web
service depends on the backup
service (or vice versa). It may be useful to create a new docker-compose file for this.docker-compose up web backup
instead of docker-compose run
docker-compose run web
and docker-compose run backup
in another shell.web
and backup
services into a single service in your docker-compose.yml
.Upvotes: 17
Reputation: 4917
Version docker-compose version 1.29.2, build 5becea4c allows it using the sintax below:
docker-compose up -d SERVICE1 SERVICE2
Upvotes: 6