开发者社区> 问答> 正文

RancherOS添加主机时不成功?报错

环境说明:

新搭建的RancherOS,地址:172.16.96.65:8080,需要添加一台agent主机。

远程Linux主机:redhat7.2系统,执行下面的命令后报错。

sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.2 http://172.16.96.65:8080/v1/scripts/B27B54914927B6973C11:1483142400000:wmSjBrl3ZNRMoNvXlMIA0HNhx4

INFO: Running Agent Registration Process, CATTLE_URL=http://172.16.96.65:8080/v1
INFO: Attempting to connect to: http://172.16.96.65:8080/v1
INFO: http://172.16.96.65:8080/v1 is accessible
INFO: Inspecting host capabilities
INFO: Boot2Docker: false
INFO: Host writable: true
INFO: Token: xxxxxxxx
INFO: Running registration
Traceback (most recent call last):
  File "./register.py", line 11, in <module>
    secret_key=os.environ['CATTLE_REGISTRATION_SECRET_KEY'])
  File "/usr/local/lib/python2.7/dist-packages/cattle.py", line 45, in from_env
    return gdapi.from_env(prefix=prefix, factory=Client, **kw)
  File "/usr/local/lib/python2.7/dist-packages/gdapi.py", line 613, in from_env
    return _from_env(prefix=prefix, factory=factory, **args)
  File "/usr/local/lib/python2.7/dist-packages/gdapi.py", line 632, in _from_env
    return factory(**result)
  File "/usr/local/lib/python2.7/dist-packages/cattle.py", line 12, in __init__
    super(Client, self).__init__(*args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/gdapi.py", line 197, in __init__
    self._load_schemas()
  File "/usr/local/lib/python2.7/dist-packages/gdapi.py", line 315, in _load_schemas
    response = self._get_response(self._url)
  File "/usr/local/lib/python2.7/dist-packages/gdapi.py", line 266, in _get_response
    self._error(r.text)
  File "/usr/local/lib/python2.7/dist-packages/gdapi.py", line 255, in _error
    raise ApiError(self._unmarshall(text))
  File "/usr/local/lib/python2.7/dist-packages/gdapi.py", line 300, in _unmarshall
    object_pairs_hook=self.object_pairs_hook)
  File "/usr/lib/python2.7/json/__init__.py", line 352, in loads
    return cls(encoding=encoding, **kw).decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

请问有经验的高手,这种错误是哪里的问题?

展开
收起
爱吃鱼的程序员 2020-06-08 14:18:16 678 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    自己解决了,居然是RancherOS默认提供的注册脚本参数有问题。

    我这个RancherOS是官网提供下载的最新版本v1.0.1

    解决办法:sudodockerrun-d--privileged-v/var/run/docker.sock:/var/run/docker.sock-v/var/lib/rancher:/var/lib/rancherrancher/agent:v1.2.2http://172.16.96.65:8080/v1/scripts/B27B54914927B6973C11:1483142400000:wmSjBrl3ZNRMoNvXlMIA0HNhx4

    2020-06-08 14:18:29
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
探索连接的最后十秒钟“落时”的网关 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载