Leandro David
Leandro David

Reputation: 597

Start only one service in a docker-compose.yml with ansible docker_service module

I have a docker-compose.yml file like this

version: '2' 
    services:
        my-service-one:
        // parameters of my-service-one
        my-service-two:
            extends: my-service-one
            //extra params for my-service-two
        my-service-three
            extends: my-service-one
            //extra params for my-service-three

And I want to start only one of the services, like my-service-three, using ansible docker_service module

I believe it will be something like:

docker_service:
    project_src: /path/to/dir/containing/docker-compose.yml
    some-parameter: my-service-three

What would be the parameter(s) to set in the docker_service module to run only one service ?

Upvotes: 1

Views: 2093

Answers (1)

Chris Lam
Chris Lam

Reputation: 3614

The document does mention the services parameter but not in an obvious way.

When state is present run docker-compose up on a subset of services.

docker_service:
  project_src: /path/to/dir/containing/docker-compose.yml
  services:
    - my_service
  state: present

Upvotes: 5

Related Questions