Docker stack files command example

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

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.