Skip to content
Go back

How to Install Docker Swarm on Ubuntu 24.04

Updated:

Ubuntu 24.04 安装 Docker Swarm 集群

先决条件

初始化集群

docker swarm init --advertise-addr <该服务器的内网 IP>
docker swarm init --advertise-addr 100.118.172.34
Swarm initialized: current node (7lhk4aqa3hs8gtcypn42sx79y) is now a manager.

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

    docker swarm join --token SWMTKN-1-1i4pp8nkzh31yiurv40y9hcf0zt7e6qan4wl7n40uu5u0enta1-6bh93gkeumrqlot45c7kcyfm1 100.118.172.34:2377

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

加入工作节点则执行

docker swarm join --token SWMTKN-1-1i4pp8nkzh31yiurv40y9hcf0zt7e6qan4wl7n40uu5u0enta1-6bh93gkeumrqlot45c7kcyfm1 100.118.172.34:2377

如果要加入管理节点则执行

docker swarm join-token manager 
# 执行后会显示如下:
To add a manager to this swarm, run the following command:

    docker swarm join --token SWMTKN-1-1i4pp8nkzh31yiurv40y9hcf0zt7e6qan4wl7n40uu5u0enta1-6wnyu0v7om1hhdhbvo68uzajs 100.118.172.34:2377

以下是Docker Swarm 常用命令

查看节点(在管理节点上执行)

将管理降级为工作节点

升级工作节点为管理节点

删除节点(或节点下线)

未完待续。。。


Share this post on:

Previous Post
How to Install Nginx Proxy Manager on Ubuntu 24.04
Next Post
docker-ce install on ubuntu 24.04