Advertisement
thesuhu

Docker Swarm

Feb 17th, 2022 (edited)
1,002
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.86 KB | None | 0 0
  1. # list node
  2. docker node list
  3.  
  4. # list all container all status
  5. docker service ps --no-trunc <service>
  6.  
  7. # list container running in one of nodes
  8. docker service ps -f "node=manager1" redis
  9.  
  10. # list container running only
  11. docker service ps -f "desired-state=running" redis
  12.  
  13. # Swarm mode with task status 'rejected', is there a way find out why a task was rejected by agent
  14. docker inspect <task id>
  15.  
  16. # change replicas
  17. docker service scale <nama service>=50
  18.  
  19. # pindahan server
  20. # ketika vm di-clone ke vm baru, ip dan hostname baru tapi ketika ketik:
  21. docker swarm join-token manager
  22. # hasilnya masih ip vm lama, solusinya:
  23. sudo systemctl stop docker
  24. sudo rm -rf /var/lib/docker/swarm
  25. sudo systemctl start docker
  26. # kemudian mulai bikin swarm baru:
  27. docker swarm init
  28. # kemudian coba cek lagi token manager, hasilnya sudah IP baru.
  29. # hati hati semua service hilang :0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement