0
我正在尝试Docker API python库,但无法获得一点成功,请仔细阅读文档。其实我试图使用API登录docker。在Python中通过Docker API设置登录
这里是我的Python代码:
import docker
config = os.path.join(BASE_DIR, 'IGui') + 'config.json'
client = docker.APIClient.login('username', '*******', '[email protected]','https://index.docker.io/v1/', config)
这是我收到的错误:
AttributeError at /gui/docker/
'str' object has no attribute '_auth_configs'
Request Method: POST
Request URL: http://127.0.0.1:8000/gui/docker/
Django Version: 1.11.3
Exception Type: AttributeError
Exception Value:
'str' object has no attribute '_auth_configs'
Exception Location: /Users/abdul/IstioVirEnv/lib/python3.6/site- packages/docker/api/daemon.py in login, line 128
Python Executable: /Users/abdul/IstioVirEnv/bin/python
Python Version: 3.6.1
怎样才能在Python API我设置泊坞窗登录?请帮帮我!
我对reauth和dockercfg参数感到困惑,有没有关于如何在python中使用docker API完成登录的示例? –
'reauth'是一个布尔值。 dockerdfg_path是一个字符串。既然你传递了一个字符串,我假设你正在尝试传递dockercfg_path。但是第四个位置参数应该是'reauth'(一个布尔值)。这可能是问题。 – DroidX86
当我通过''False''为** reauth **它仍然通过相同的错误:''str'对象没有属性'_auth_configs'' –