Rancher cannot build a docker swarm on centos

Hi,
I use the rancher to build a docker swarm environment。The infrastructure list is as follows:
one rancher:stable and Three centos7 virtual machines with docker 1.13.1.
I added the host to the environment, but when the host was added, the swarmkit container never started properly. The error log for the swarmkit container is as follows:
Metadata not ready 2017-6-1 14:55:51Metadata not ready 2017-6-1 14:55:57Metadata not ready 2017-6-1 14:56:03Metadata not ready 2017-6-1 14:56:09Metadata not ready 2017-6-1 14:56:12time="2017-06-01T06:56:12Z" level=info msg="Listening on port: 2378" 2017-6-1 14:56:12+ docker swarm init --advertise-addr 172.16.187.191:2377 2017-6-1 14:56:13Swarm initialized: current node (5vi5l60pgjx16axvrbqj4rabr) is now a manager. 2017-6-1 14:56:13 2017-6-1 14:56:13+ set +x 2017-6-1 14:56:13To add a worker to this swarm, run the following command: 2017-6-1 14:56:13 2017-6-1 14:56:13 docker swarm join \ 2017-6-1 14:56:13 --token SWMTKN-1-20jd6ke0lxlyz7vh8c1p7pc6yz2wbfd6t3vg2hy0n4gzvfv0jw-750l5jegc48v0omvuimr9qsnw \ 2017-6-1 14:56:13 172.16.187.191:2377 2017-6-1 14:56:13 2017-6-1 14:56:13To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions. 2017-6-1 14:56:13 2017-6-1 14:56:14Set swarm join-tokens 2017-6-1 14:56:14Set host label swarm=manager 2017-6-1 14:56:44Error response from daemon: rpc error: code = 9 desc = attempting to demote the last manager of the swarm 2017-6-1 14:56:44Error response from daemon: rpc error: code = 9 desc = node 5vi5l60pgjx16axvrbqj4rabr is a cluster manager and is a member of the raft cluster. It must be demoted to worker before removal 2017-6-1 14:56:44Removed 5vi5l60pgjx16axvrbqj4rabr from the swarm. 2017-6-1 14:56:441 of 1 manager(s) reachable, 0 worker(s) active 2017-6-1 14:56:44No active workers present for promotion, add more nodes to enable reconciliation. 2017-6-1 14:57:15Error response from daemon: rpc error: code = 9 desc = attempting to demote the last manager of the swarm 2017-6-1 14:57:15Error response from daemon: rpc error: code = 9 desc = node 5vi5l60pgjx16axvrbqj4rabr is a cluster manager and is a member of the raft cluster. It must be demoted to worker before removal 2017-6-1 14:57:15Removed 5vi5l60pgjx16axvrbqj4rabr from the swarm. 2017-6-1 14:57:151 of 1 manager(s) reachable, 0 worker(s) active 2017-6-1 14:57:15No active workers present for promotion, add more nodes to enable reconciliation. 2017-6-1 14:57:45Error response from daemon: rpc error: code = 9 desc = attempting to demote the last manager of the swarm 2017-6-1 14:57:45Error response from daemon: rpc error: code = 9 desc = node 5vi5l60pgjx16axvrbqj4rabr is a cluster manager and is a member of the raft cluster. It must be demoted to worker before removal 2017-6-1 14:57:45Removed 5vi5l60pgjx16axvrbqj4rabr from the swarm. 2017-6-1 14:57:451 of 1 manager(s) reachable, 0 worker(s) active 2017-6-1 14:57:45No active workers present for promotion, add more nodes to enable reconciliation. 2017-6-1 14:58:15Error response from daemon: rpc error: code = 9 desc = attempting to demote the last manager of the swarm 2017-6-1 14:58:15Error response from daemon: rpc error: code = 9 desc = node 5vi5l60pgjx16axvrbqj4rabr is a cluster manager and is a member of the raft cluster. It must be demoted to worker before removal 2017-6-1 14:58:15Removed 5vi5l60pgjx16axvrbqj4rabr from the swarm. 2017-6-1 14:58:151 of 1 manager(s) reachable, 0 worker(s) active 2017-6-1 14:58:15No active workers present for promotion, add more nodes to enable reconciliation. 2017-6-1 14:58:45Error response from daemon: rpc error: code = 9 desc = attempting to demote the last manager of the swarm 2017-6-1 14:58:45Error response from daemon: rpc error: code = 9 desc = node 5vi5l60pgjx16axvrbqj4rabr is a cluster manager and is a member of the raft cluster. It must be demoted to worker before removal 2017-6-1 14:58:45Removed 5vi5l60pgjx16axvrbqj4rabr from the swarm. 2017-6-1 14:58:451 of 1 manager(s) reachable, 0 worker(s) active 2017-6-1 14:58:45No active workers present for promotion, add more nodes to enable reconciliation. 2017-6-1 14:59:16Error response from daemon: rpc error: code = 9 desc = attempting to demote the last manager of the swarm 2017-6-1 14:59:16Error response from daemon: rpc error: code = 9 desc = node 5vi5l60pgjx16axvrbqj4rabr is a cluster manager and is a member of the raft cluster. It must be demoted to worker before removal 2017-6-1 14:59:16Removed 5vi5l60pgjx16axvrbqj4rabr from the swarm. 2017-6-1 14:59:161 of 1 manager(s) reachable, 0 worker(s) active 2017-6-1 14:59:16No active workers present for promotion, add more nodes to enable reconciliation. 2017-6-1 14:59:46Manager 5vi5l60pgjx16axvrbqj4rabr demoted in the swarm. 2017-6-1 14:59:46Removed 5vi5l60pgjx16axvrbqj4rabr from the swarm. 2017-6-1 14:59:46Error response from daemon: This node is not a swarm manager. Worker nodes can't be used to view or modify cluster state. Please run this command on a manager node or promote the current node to a manager. 2017-6-1 14:59:46Error response from daemon: This node is not a swarm manager. Worker nodes can't be used to view or modify cluster state. Please run this command on a manager node or promote the current node to a manager. 2017-6-1 14:59:46Error response from daemon: This node is not a swarm manager. Worker nodes can't be used to view or modify cluster state. Please run this command on a manager node or promote the current node to a manager. 2017-6-1 14:59:46Removed 5vi5l60pgjx16axvrbqj4rabr from the swarm. 2017-6-1 14:59:46jq: error (at <stdin>:1): Cannot index string with string "Spec" 2017-6-1 14:59:46jq: error (at <stdin>:1): Cannot index string with string "Spec" 2017-6-1 14:59:46jq: error (at <stdin>:1): Cannot index string with string "Spec" 2017-6-1 14:59:46/opt/rancher/run.sh: line 245: + : syntax error: operand expected (error token is "+ ") 2017-6-1 14:59:47time="2017-06-01T06:59:47Z" level=info msg="Listening on port: 2378" 2017-6-1 14:59:47jq: error (at <stdin>:1): Cannot index string with string "Description" 2017-6-1 14:59:48jq: error (at <stdin>:1): Cannot index string with string "Spec" 2017-6-1 14:59:48jq: error (at <stdin>:1): Cannot index string with string "Spec" 2017-6-1 14:59:48jq: error (at <stdin>:1): Cannot index string with string "Spec" 2017-6-1 14:59:48/opt/rancher/run.sh: line 245: + : syntax error: operand expected (error token is "+ ")

I tried using docker 17.0.5 and 1.12.6 versions of docker on centos7, but it was the same
I tried using docker 17.0.3 on ubuntu 16.0.4, it is successful.

can you help me?

the info of docker node

the info of the docker node

the info of the docker node

Have to do some more testing but could you try setting it up again, but set correct hostnames on the machines before? As far as I can see all your machines are localhost.localdomain ?

Let me know, I’ll keep on testing.

Thanks for your reply. Now I can build swarm by Rancher. My solution is to add a swarm template that sets the number of manager of the template to 1, and the environment that is built using this template does not have a problem with the swarmkit container.

Of course I hope to help you improve the product. Here are the details of my problems. I hope these will help you.

  1. I am using is centos7 Vbox virtual machine of the system, and after the installation is complete systems and software updates by copying the virtual machine, so that all host names are the same.

  2. I installed a version of docker1.13.1 for three virtual machines. Rancher version is stable , and the template for creating the environment is the default swarm template.

  3. I can’t build a cluster, as I described, by adding the host method.

  4. I tested for docker 17.0.5, but it was the same problem.

  5. I change another computer and do the same thing, and I still have this problem

  6. I installed ubuntu16.0.4 in virtual machine and do the same thing and I didnt have the problem.

  7. I check swarmkit container log, often see ‘demote latest manager’, I use three host, the default templates are three management node, that is mean when I add a host and the host number is not more than three, should all the host is the manager node, but not be deprived of the existing management node identity.

I am poor in English, I hope you understand what I mean, and what I can offer, please reply to me. thank you

------------------ 原始邮件 ------------------
发件人: “Sebastiaan van Steenis”;rancher@discoursemail.com;
发送时间: 2017年6月3日(星期六) 晚上8:59
收件人: "年少&轻狂"1026524749@qq.com;

主题: [Rancher Forums] Rancher cannot build a docker swarm on centos

                                                superseb         
     June 3            

Have to do some more testing but could you try setting it up again, but set correct hostnames on the machines before? As far as I can see all your machines are localhost.localdomain ?

Let me know, I’ll keep on testing.

Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.