Manage docker with stack files as yml format
Docker stack files are managed in yml format. You can create multiple service environment with multiple instance and multiple replica by using this yml file with one go.
sunny@Oracle1:~/Desktop$ docker stack
Usage: docker stack [OPTIONS] COMMAND
Manage Docker stacks
Options:
--orchestrator string Orchestrator to use (swarm|kubernetes|all)
Commands:
deploy Deploy a new stack or update an existing stack
ls List stacks
ps List the tasks in the stack
rm Remove one or more stacks
services List the services in the stack
Run 'docker stack COMMAND --help' for more information on a command.
Check docker stack has any service:
#docker stack ls
Check process running in Stack:
#docker stack ps <stackname>
Change the replica with stack service:
#docker service update --replicas=20 <nameofstackservice>
Note: if you don’t modify in stack file and update directly in the command then on restart it will start only allocated replicas that written in yml file. So modify the yml file.
Deploy the docker stack:
#docker stack deploy --compose-file ymlfilename.yml <givenameotstack>
example:
#docker stack deploy --compose-file docker-stack.yml mystack