我有一个应用程序需要在ipv6上侦听特定端口。我已经在docker文件中公开了它,并且我正在使用DOCKER_OPTS="--ipv6"
运行docker引擎,但我无法让docker通过ipv6正确映射端口。
使用docker inspect {name}
时显示端口(请参阅下面的输出 - 编辑以消除多余的东西)。出于某种原因,我不能让它来路由IPv6的东西(但是看起来端口只是从下面的输出中暴露为ipv4)。
如何通过与主机的ipv6连接访问端口(9084),就像通过与主机的ipv4连接可访问其他两个端口一样?
[
{
// [...]
"HostConfig": {
// [...]
"NetworkMode": "default",
"PortBindings": {
"8883/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "8883"
}
],
"9084/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "9084"
}
],
"9094/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "9094"
}
]
},
// [...]
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "",
"Cgroup": "",
"Links": null,
// [...]
},
// [...]
"Config": {
"Hostname": "40c7aa89b266",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"8883/tcp": {},
"9084/tcp": {},
"9094/tcp": {}
},
// [...]
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "97923c78571e880f267b56f4d86a7338e2f7a878d20b9961ae208af9c2bc6b64",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"8883/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "8883"
}
],
"9084/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "9084"
}
],
"9094/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "9094"
}
]
},
"SandboxKey": "/var/run/docker/netns/97923c78571e",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "cdddc3cd29e3cb40f68cf696f0d6dffadd08aa5bf256cd12cef180f04795ee83",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "fe80::242:ac11:4",
"GlobalIPv6PrefixLen": 64,
"IPAddress": "172.17.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "fe80::1",
"MacAddress": "02:42:ac:11:00:04",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "3371009b227abe4e8992fbd9a56ea662ee76fd692b6d7080045d5deb055e29e3",
"EndpointID": "cdddc3cd29e3cb40f68cf696f0d6dffadd08aa5bf256cd12cef180f04795ee83",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "fe80::1",
"GlobalIPv6Address": "fe80::242:ac11:4",
"GlobalIPv6PrefixLen": 64,
"MacAddress": "02:42:ac:11:00:04"
}
}
}
}
]