Docker Community Forums

Share and learn in the Docker community.

Windows & Linux in same swarm using compose


(Rusticileeroy) #1

Been going over the docs all day and i’m clearly not getting something, so reaching out for help…

What i need to do is spin up a Windows hosted container to run a .Net application and link that to a database container, run some tests and then discard the containers.
I’ve successfully done that using docker-compose using a java application & db using a compose file like:

version: "2"
services:
engine:
build: ./containers/posix/engine-java
depends_on:
- database
ports:
- "8888:8080"
database:
image: mysql
environment:

Now, what i was hoping to do for a combo that required .Net was something like:

version: "2"
services:
engine:
build: ./containers/windows/engine-net
depends_on:
- database
ports:
- "8888:8080"
environment:
- "constraint:OS=windows"
database:
image: mysql
environment:
- “constraint:OS=linux”

Then add the OS labels to the swarm nodes using:
docker node update --label-add OS=value nodeId

I can’t turn my docker-compose.yml into a bundle for 2 reasons:
1 - it doesn’t like build: it requires image:
2 - even if i change it to image: microsoft/windowsservercore (for example), i can’t generate the bundle on linux because it doesn’t have the image and won’t pull it either. I only have an AWS Windows with containers box for my Windows stuff and that doesn’t come with docker-compose.

I tried forcing a hello-world image to run on the windows node using the same constraints as above, turning it into a .dab and deploying it to the swarm but it always ran on the master linux node.

So…
1 - Is what i’m trying to do actually possible on docker?
2 - would it help if i ran docker-compose bundle on a Windows box, transferred the .dab to the swarm host for running.
3 - If so, can i install docker-compose for Windows on that AWS box without messing up/interfering with the docker install that is bundled with it.

Hope that makes sense. Thanks for the help!


(Sify21) #2

Hi @rusticileeroy, Do you have any progress on this? I’m facing with the same problem