進階功能

將節點改為 Manager:docker node promote <HOSTNAME>
降級為docker node demote <HOSTNAME>。

把樹梅派提昇為manager

sudo  docker node ls
ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
x0544nvby7gt0zaxp30gjjqov *   pi-GB-BSi5A-6200    Ready               Active              Leader              18.09.9
pje55mj8gzj7q8obzz1la5c6s     raspberrypi4        Ready               Active                                  19.03.7
vz8vwt7bom9s2go59wtt04lbf     ubuntu-mate         Ready               Active                                  19.03.3

pi@pi-GB-BSi5A-6200:~$ sudo docker node promote raspberrypi4
Node raspberrypi4 promoted to a manager in the swarm.
docker service ps web
ID                  NAME                IMAGE               NODE                DESIRED STATE       CURRENT STATE             ERROR               PORTS
724wbwb9726s        web.1               httpd:latest        ubuntu-mate         Running             Running 2 minutes ago                         
gjxy4omk2l8z         \_ web.1           httpd:latest        ubuntu-mate         Shutdown            Shutdown 2 minutes ago                        
mmpqoj5utk8p         \_ web.1           httpd:latest        ubuntu-mate         Shutdown            Shutdown 31 minutes ago                       
lyvb8dv5wvhm        web.2               httpd:latest        pi-GB-BSi5A-6200    Running             Running 3 minutes ago                         
v0bxq1woot0z         \_ web.2           httpd:latest        pi-GB-BSi5A-6200    Shutdown            Shutdown 3 minutes ago                        
8x96uox5l6y7         \_ web.2           httpd:latest        pi-GB-BSi5A-6200    Shutdown            Shutdown 31 minutes ago                       
i973lbm3tk2p        web.3               httpd:latest        raspberrypi4        Running             Running 2 minutes ago                         
kv0zptya0hxk         \_ web.3           httpd:latest        raspberrypi4        Shutdown            Shutdown 2 minutes ago        

Last updated