我试图使用docker
的远程api绑定主机,但总是失败。在
我使用python和urllib2
传递这个dict
:
{
'Tty':True,
'Volumes':[],
'Image':'ubuntu',
'Cmd':'',
'WorkingDir':None,
'Entrypoint':None,
'Env':None,
'AttachStdin':False,
'AttachStdout':True,
'AttachStderr':True,
'OpenStdin':True,
'ExposedPorts':{'80/tcp':{}},
'HostConfig':{'PortBindings':{'80/tcp':['15080']}}
}
然后我使用远程api来检查容器,它给出了以下信息:
^{pr2}$我还尝试使用这个链接Binding a port to a host interface using the REST API中的方法, 但是当我发布数据来启动容器时,它将引发HTTP错误500。所以我猜docker远程api是否被更改了。在
您的
PortBindings
参数似乎有点不正常。您缺少"HostPort":
更改为:
从docs:
相关问题 更多 >
编程相关推荐