Use docker-compose with docker swarm

后端 未结 2 924
一个人的身影
一个人的身影 2021-01-16 07:04

I\'m using docker 1.12.1 I have an easy docker-compose script.

version: \'2\'

services:
  jenkins-slave:
    build: ./slave
    image: jenkins         


        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-16 07:45

    Compose doesn't support Swarm Mode at the moment.

    When you run docker compose up on the master node, Compose issues docker run commands for the services in the Compose file, rather than docker service create - which is why the containers all run on the master. See this answer for options.

    On the second point, networks are scoped in 1.12. If you inspect your network you'll find it's been created at swarm-level, but Compose is running engine-level containers which can't see the swarm network.

提交回复
热议问题