1

i have some questions in docker stack windows.

Can we enable docker stack in windows 2016. Is it fully supported.

if yes, how can we enable. how we can automate creating swarm cluster using this file. i have searched google but can't find related to windows. please provide me If you have any links to study.

karthick
  • 175
  • 1
  • 7

1 Answers1

2

Docker stack is somehow the equivalent for docker-compose but in swarm. A stack is a composition of multiple services defined in a stack file. You deploy a stack on a docker swarm which results in the creation of multiple services in that swarm.

You need first to have a swarm created by running docker swarm init and then you deploy the stack to the swarm by running docker stack deploy --compose-file stack-file.yml <stack-name>. Note that the same docker compose file you use, can be used to deploy the containers in swarm mode.

yamenk
  • 46,736
  • 10
  • 93
  • 87
  • i have a another question. can we use both docker compos and docker stack commands in one file. with one command – karthick Sep 08 '17 at 07:16
  • Yes. But the commands will target differnet things that are separate. – yamenk Sep 08 '17 at 07:23
  • i have run the docker stack file, but some services are not replicated and i am unable to connect out side from the host. when i was trying this via manually it is working properly. i can see the ports are not mapped properly. – karthick Sep 08 '17 at 10:20
  • version: '3.0' networks: default: external: name: test01 services: mssql: image: microsoft/mssql-server-windows-developer environment: - SA_PASSWORD=Password1 - ACCEPT_EULA=Y ports: - 1433:1433 volumes: - c:\Databases:c:\Databases deploy: placement: constraints: [node.labels.os==Windows] web: image: iiswithdb:latest ports: - 8080:8080 deploy: replicas: 3 lbs: image: nginx:latest ports: - 80:80 deploy: placement: constraints: [node.labels.os==Windows] – karthick Sep 08 '17 at 10:20
  • how to specify the default network i tried networks: default: external: name: nat. but it says unable to find the network name nat. I used ingress as well but issue seemes same – karthick Sep 08 '17 at 10:30
  • You need to create the network named nat using docker network create -d overlay nat – yamenk Sep 08 '17 at 10:46
  • i have created the overlay network manually and update in the n/w section in the docker-compose file. but it saying "Could not attach to network test01: rpc error: code = 7 desc = network test01 not manually attachable ERROR: Encountered errors while bringing up the project." i have created like this. version: '3.0' networks: default: external: name: test01 i have tried ingress n/w as well but same result – karthick Sep 08 '17 at 11:18