Reputation: 12412
We are using docker-compose in our dev environment to start all the services.
Does any one know if I can start just 1 service using docker-compose without checking if dependencies are running or not (since I know they are running)?
$ docker-compose -f docker-compose-service1.yml up
it gives an error: ERROR: Service ‘service1’ depends on service ‘service2’ which is undefined.
The yml file looks something like:
version: '2'
services:
service1:
build: ./service1
dns: 192.168.1.100
depends_on:
- "service2"
container_name: service1
I just want to start service1 since I know all the dependencies are already running.
Upvotes: 16
Views: 16613
Reputation: 10447
If other services are running and you want to restart only one, you can use
docker-compose -f docker-compose.yml restart service1
Edit:
Regarding error:
ERROR: Service ‘service1’ depends on service ‘service2’ which is undefined.
It is because the docker-compose.yml
which is used to up
the services is not acceptable to docker-compose. First the yml file is compiled (the point of failure in our case) to see if everything is as per proper syntax, and then it is executed.
Upvotes: 23