Estou tentando desenvolver um serviço de enxame simples com o docker, estou usando o arquivo de compilação abaixo do docker
version: '3.2'
services:
sessions:
image: redis:4
ports:
- 6379:6379
networks:
web:
aliases:
- redis
cowsay-service:
image: spsarolkar/cowsay
ports:
- 8000
environment:
- SERVICE_PORTS=8000
deploy:
replicas: 5
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
networks:
- web
cowsay-proxy:
image: dockercloud/haproxy
depends_on:
- cowsay-service
environment:
- BALANCE=leastconn
volumes:
- /var/run/docker.sock:/var/run/docker.sock
ports:
- "8000:80"
networks:
web:
aliases:
- cowsay
cowsay-ui:
image: spsarolkar/cowsay-ui
ports:
- "[::1]:8080:8080"
depends_on:
- redis
- cowsay
networks:
- web
networks:
web:
driver: overlay
Quando tento acessar meu serviço em 8080 usando curl -v http://localhost:8080
, a conexão é bem-sucedida, mas não recebo nenhuma saída e a solicitação é interrompida indefinidamente, conforme abaixo
sunils@sunils-pc /mnt/share/sunils/repos/github/ec2-sample-docker $ curl -v http://localhost:8080
* Rebuilt URL to: http://localhost:8080/
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.61.0
> Accept: */*
>
Embora eu possa acessar o serviço quando uso ipv4 curl -v http://localhost:8080
sunils@sunils-pc /mnt/share/sunils/repos/github/ec2-sample-docker $ curl -4 -v http://localhost:8080
* Rebuilt URL to: http://localhost:8080/
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.61.0
> Accept: */*
>
< HTTP/1.1 200
< Set-Cookie: XSRF-TOKEN=9dce2aac-30dd-434d-b0ad-8858e412f4ad; Path=/
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Content-Type: text/html;charset=UTF-8
< Content-Language: en-US
< Transfer-Encoding: chunked
< Date: Thu, 27 Sep 2018 15:57:27 GMT
<
<!doctype html>
...
Eu já habilitei o ipv6 na máquina local e o docker também tem o ipv6 ativado
10: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:93:8b:01:d4 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
inet6 2001:db8:1::1/64 scope global tentative
valid_lft forever preferred_lft forever
inet6 fe80::1/64 scope link tentative
valid_lft forever preferred_lft forever
11: docker_gwbridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:0c:29:e9:28 brd ff:ff:ff:ff:ff:ff
inet 172.18.0.1/16 brd 172.18.255.255 scope global docker_gwbridge
valid_lft forever preferred_lft forever
inet6 fe80::42:cff:fe29:e928/64 scope link
valid_lft forever preferred_lft forever
Quando eu inspeciono minha rede usando docker network inspect prod_web
, vejo que não há endereço ip v6 atribuído a containers
[
{
"Name": "prod_web",
"Id": "finyqtzsvgceyzfqak83burjz",
"Created": "2018-09-26T23:42:49.383967019+05:30",
"Scope": "swarm",
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "10.0.0.0/24",
"Gateway": "10.0.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"13f94f6444f8109c546c2e4124993e4431f857128ddbc0c6245485e91d675360": {
"Name": "prod_cowsay-service.2.l2jbq045g8evyjvgsn1253t1t",
"EndpointID": "4f096fb212347335874cdb3816ae259516ff05c28fd7aaef0a8dda886596e0e1",
"MacAddress": "02:42:0a:00:00:05",
"IPv4Address": "10.0.0.5/24",
"IPv6Address": ""
},
"2a361c5d113c46aa98192a2e83281215f67ba1db51ea4486ae7379806ba02027": {
"Name": "prod_cowsay-ui.1.69npxb9xv2epx3n5yi2ysvd3t",
"EndpointID": "f0a206ffbfaf000e89c11b9a5c3ba05d2c9892b7ac346007ec5d8dc9633f250b",
"MacAddress": "02:42:0a:00:00:04",
"IPv4Address": "10.0.0.4/24",
"IPv6Address": ""
},
"2a6c7ff057a4925512a37efd9f8de46904c07a2791f635ee8dbd0e6aa41789df": {
"Name": "prod_cowsay-service.1.45qqm0ccey6gdnq1yykayc7vi",
"EndpointID": "c972bbfb01efe87aa76696143959e7713c41a96c9e6c65eeedc20fafa48994f8",
"MacAddress": "02:42:0a:00:00:0e",
"IPv4Address": "10.0.0.14/24",
"IPv6Address": ""
},
"6314a118b79d52bf0d8b94111046a7f1d191df2b53a72015bf4bc151a1693d2e": {
"Name": "prod_cowsay-service.5.vx04rz82ofp1mhaoptt65hndk",
"EndpointID": "8c73e4ec8af0cdc7c15ef9ee7b27f727dc0e5f6f002c5ec8d97cd7578c3cbe97",
"MacAddress": "02:42:0a:00:00:06",
"IPv4Address": "10.0.0.6/24",
"IPv6Address": ""
},
"91fe104922b48f5d3152af2dfdae17b814bf4b9b8e54af6578c95d8cd0789d40": {
"Name": "prod_cowsay-service.4.mj2r0b6v67z18yoojzq28ux1t",
"EndpointID": "284d25741cbd3b9a3edc8ab1e4302cf3ff05f0f2e13c898608c45521e495c141",
"MacAddress": "02:42:0a:00:00:0c",
"IPv4Address": "10.0.0.12/24",
"IPv6Address": ""
},
"e1230af527d57cf71847e50ade05b5f207cd6448e6377cb050e3a920a3d62fb7": {
"Name": "prod_cowsay-service.3.o11gy8bgxzifj158t7nvabcxk",
"EndpointID": "a3c952e5f1baa0f36e9a5f375bf90a4f3a4016999e6de6afd13e95e1004d3310",
"MacAddress": "02:42:0a:00:00:08",
"IPv4Address": "10.0.0.8/24",
"IPv6Address": ""
},
"f4cc204b25b74ab49916fb5cbe45a1fb1267242578a1daaa7421b9360e8d9e0d": {
"Name": "prod_sessions.1.eug36ekd0ll6m7bscv1n1vj84",
"EndpointID": "0fb9edf81dae304f75cc61b7dba52ac541a6db058d01b019b05e0adf0e91581d",
"MacAddress": "02:42:0a:00:00:07",
"IPv4Address": "10.0.0.7/24",
"IPv6Address": ""
},
"f8924c272bb67ab5681a62e55d4c5cbbddb09cc5258cbb766411ab6acc657459": {
"Name": "prod_cowsay-proxy.1.oqvnqz37axyoa6l36vfrn3isv",
"EndpointID": "337c7fc2b768a06b2cb25aec46f5e50e1dde9906b4c5c0af4003341bdd9900b3",
"MacAddress": "02:42:0a:00:00:0a",
"IPv4Address": "10.0.0.10/24",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.driver.overlay.vxlanid_list": "4097"
},
"Labels": {
"com.docker.stack.namespace": "prod"
},
"Peers": [
{
"Name": "3673f88acdca",
"IP": "192.168.0.11"
}
]
}
]
Não tenho certeza se o endereço IPv6 em branco é a causa raiz. Alguém pode me ajudar a resolver o problema acima
Tags networking ipv6 docker linux gentoo