開工設置HOST1

在Manager節點和Worker節點上配置的靜態IP地址。在這裡,我們將IP 192.168.43.100用於管理器節點並將IP 192.168.43.101用於工作器節點。

Docker Swarm由兩個主要組件組成:

  • 管理者節點

  • 工作節點

HOST1:192.168.43.100

使用IP地址初始化集群,以便您的節點充當Manager節點。在管理器節點上,運行以下命令來發布IP地址

docker swarm init --advertise-addr 192.168.43.100 您應該看到以下輸出

sudo docker swarm init --advertise-addr 192.168.43.100
Swarm initialized: current node (x0544nvby7gt0zaxp30gjjqov) is now a manager.

To add a worker to this swarm, run the following command:

    docker swarm join --token SWMTKN-1-3ltemfcbr4wa71zfctzpzkzzp7wxfijrm17fv7m1u4t60c8gp4-0p5ak00mdqd6flp0d0doa88qy 192.168.43.100:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

docker node ls如果一切正常,您應該看到以下輸出:

sudo docker node ls
ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
x0544nvby7gt0zaxp30gjjqov *   pi-GB-BSi5A-6200    Ready               Active              Leader              18.09.9

檢查Docker Swarm集群的狀態:代碼> docker info

您應該看到以下輸出:

sudo docker info
Containers: 3
 Running: 3
 Paused: 0
 Stopped: 0
Images: 27
Server Version: 18.09.9
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: active
 NodeID: x0544nvby7gt0zaxp30gjjqov
 Is Manager: true
 ClusterID: a5ck9rf2ycv821tvvxsxw5g7v
 Managers: 1
 Nodes: 1
 Default Address Pool: 10.0.0.0/8  
 SubnetSize: 24
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 10
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
  Force Rotate: 0
 Autolock Managers: false
 Root Rotation In Progress: false
 Node Address: 192.168.43.100
 Manager Addresses:
  192.168.43.100:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: N/A
init version: fec3683
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 5.4.0-9-generic
Operating System: Ubuntu Core 16
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.653GiB
Name: pi-GB-BSi5A-6200
ID: KIMZ:SYEQ:3RU5:7UWJ:2WO4:JZ4F:NEVN:X6CA:FW5P:SQSF:S2BD:BWXO
Docker Root Dir: /var/snap/docker/common/var-lib-docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

Last updated