Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
182 views
in Technique[技术] by (71.8m points)

Start a docker service based on another service

Is there a possibility to start a service on a specific node, based on another running service? (using Docker Swarm)

To make myself a little more clear:

I want to run Nextcloud on a different node than for example, a Typo3, to spare some resources on my Nextcloud node.

How would I write that in a compose?

question from:https://stackoverflow.com/questions/65938414/start-a-docker-service-based-on-another-service

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Look into deploy and using labels:

Example:

        deploy:
            mode: replicated
            replicas: 1
            placement:
                constraints:
                - node.labels.NextcloudDaemon == true
            restart_policy:
                condition: any

The above example will run exactly 1 container, and only on the node you've already given the label of "NextcloudDaemon".


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...