LoginSignup
1
0

Docker Swarm モードの有効化

Last updated at Posted at 2024-03-14

Swarm モード

Swarm モードは、Docker デーモンのクラスターを管理するための高度な機能です。
Swarm モードは、defaultで無効です。

$ docker info
Client:
 Context:    default
 Debug Mode: false
・・・
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
・・・

Swarm モードは、初期化で有効になります。

$ docker swarm init
Swarm initialized: current node (a5o7tzybrz3k336auye8rxmh5) is now a manager.

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

    docker swarm join --token SWMTKN-1-4gf9t82xco7uzvmk1q18any5aoujjavsoians9qlqcfs2g97j8-72j79x3z8ml4pnigntzieonke <IPアドレス>:2377

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

Swarm モード有効化の確認

$ docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.4
・・・
 Swarm: active
  NodeID: a5o7tzybrz3k336auye8rxmh5
  Is Manager: true
  ClusterID: dg8fadxhrszqblg394aqkc1rl
  Managers: 1
  Nodes: 1
  Default Address Pool: 10.0.0.0/8
  SubnetSize: 24
  Data Path Port: 4789
  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: <IPアドレス>
  Manager Addresses:
   <IPアドレス>:2377

Swarm モードnodeの確認

$ docker node ls
ID                            HOSTNAME   STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
a5o7tzybrz3k336auye8rxmh5 *   P88074     Ready     Active         Leader           23.0.3

Swarm モードネットワークの確認

$ docker network ls
NETWORK ID     NAME              DRIVER    SCOPE
2461d9072732   bridge            bridge    local
4850a652ee25   docker_gwbridge   bridge    local
0ca730ab1c0e   host              host      local
6snud5sgnhtx   ingress           overlay   swarm
4b11b0190fa9   none              null      local

新たに2つのネットワーク(docker_gwbridge、ingress)が作成されています。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0