I have a compose file:
docker-compose.yml
openjdk-6b36-jdk:
image: java:openjdk-6b36-jdk
volumes:
- ./src:/src
- ./build/openjdk-6b36-jdk:/build
command: /src/compileAndTest
openjdk-7u79-jdk:
image: java:openjdk-7u79-jdk
volumes:
- ./src:/src
- ./build/openjdk-7u79-jdk:/build
command: /src/compileAndTest
openjdk-8u66-jdk:
image: java:openjdk-8u66-jdk
volumes:
- ./src:/src
- ./build/openjdk-8u66-jdk:/build
command: /src/compileAndTest
it runs fine:
-bash-4.2$ docker-compose up
Starting compose_openjdk-7u79-jdk_1
Starting compose_openjdk-8u66-jdk_1
Starting compose_openjdk-6b36-jdk_1
Attaching to compose_openjdk-8u66-jdk_1, compose_openjdk-7u79-jdk_1, compose_openjdk-6b36-jdk_1
openjdk-7u79-jdk_1 | Hello, World
openjdk-8u66-jdk_1 | Hello, World
openjdk-6b36-jdk_1 | Hello, World
compose_openjdk-7u79-jdk_1 exited with code 0
compose_openjdk-8u66-jdk_1 exited with code 0
compose_openjdk-6b36-jdk_1 exited with code 0
i would like to run this across swarm cluster What would be the command to do so?
would it be something like docker -H :4000 run <something>?
because that the command i used to run images on swarm nodes
I can run docker -H :4000 run hello-world
fine but those are docker images. how do you run docker compose across swarm cluster?
ie i want compose_openjdk-7u79-jdk_1 to go to one node and compose_openjdk-8u66-jdk_1 to go to another node and so forth?
According to the documentation you can add contraints
to services:
https://docs.docker.com/compose/swarm/#/manual-scheduling
I have not tested it myself.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.