Giter VIP home page Giter VIP logo

docker-swarm-hands-on's Introduction

Docker Swarm Hands On

Docker Swarm Commands

Initialize swarm

Note: this command must be run on the manager node.

Note: Use the --force-new-cluster flag to use existing settings. Swarm settings are in /var/lib/docker/swarm.

docker swarm init --advertise-addr IP 

Get command to add new worker nodes

Note: this command must be run on the manager node.

docker swarm join-token worker

Get command to add new manager nodes

Note: this command must be run on the manager node.

docker swarm join-token manager

Leave swarm

Note: this command must be run on the node you want to remove from the swarm.

docker swarm leave

List nodes

Note: this command must be run on the manager node.

docker node ls

Remove node

Note: this command must be run on the manager node.

docker node rm NODE_ID

Show node details

Note: this command must be run on the manager node.

docker node inspect NODE_ID

Demote a manager node

Note: this command must be run on the manager node.

docker node demote NODE_ID

Restrict the execution of services on a node

Note: this command must be run on the manager node.

docker node update --availability drain NODE_ID

Create service

Note: this command must be run on the manager node.

docker service create IMAGE

Create service in global mode

Note: this command must be run on the manager node.

docker service create --mode global IMAGE

Remove service

Note: this command must be run on the manager node.

docker service rm SERVICE_ID

List services

Note: this command must be run on the manager node.

docker service ls

List service tasks

Note: this command must be run on the manager node.

docker service ps SERVICE_ID

Restrict service to run only on worker nodes

Note: this command must be run on the manager node.

docker service update --constraint-add node.role==worker SERVICE_ID

Note: To remove the above restriction, use the command docker service update --constraint-rm node.role==worker SERVICE_ID.

Increase the number of replicas of a service

Note: this command must be run on the manager node.

docker service update --replicas NUMBER_OF_REPLICAS SERVICE_ID

Or

docker service scale SERVICE_ID=NUMBER_OF_REPLICAS

Deploy stack

Note: this command must be run on the manager node.

docker stack deploy --compose-file docker-compose.yml STACK_NAME

List stacks

Note: this command must be run on the manager node.

docker stack ls

Remove stack

Note: this command must be run on the manager node.

docker stack rm STACK_NAME

Docker Machine Commands

Create VM

docker-machine create --virtualbox-no-vtx-check --virtualbox-cpu-count=2 -d virtualbox VM_NAME

List VM

docker-machine ls

Remote VM

docker-machine rm VM_NAME

Start VM

docker-machine start VM_NAME

Stop VM

docker-machine stop VM_NAME

Access VM via SSH

docker-machine ssh VM_NAME

docker-swarm-hands-on's People

Contributors

publiosilva avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.