docker 容器无法访问 localhost webhook
docker container has no access to localhost webhook
在构建 docker 容器之前,我正在本地处理我们的 webhook,并希望我的 (Linux) 容器使用 host.docker.internal:ping
.[=21= 与其通信]
它以前一直在工作,但最近,由于某种原因,我从我们的 graphql-engine
、Hasura 收到此错误:
{
"timestamp":"2019-11-05T18:45:32.860+0000",
"level":"error",
"type":"webhook-log",
"detail":{
"response":null,
"url":"http://host.docker.internal:3000/simple/webhook",
"method":"GET",
"http_error":{
"type":"http_exception",
"message":"ConnectionFailure Network.Socket.getAddrInfo (called with preferred socket type/protocol: AddrInfo {addrFlags = [AI_ADDRCONFIG], addrFamily = AF_UNSPEC, addrSocketType = Stream, addrProtocol = 0, addrAddress = <assumed to be undefined>, addrCanonName = <assumed to be undefined>}, host name: Just \"host.docker.internal\", service name: Just \"3000\"): does not exist (Temporary failure in name resolution)"
},
"status_code":null
}
}
这是我的 docker 撰写:
version: '3.6'
services:
postgres:
image: postgres:11.2
restart: always
ports:
- 5432:5432
volumes:
- postgres:/var/lib/postgresql/data
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=...
- POSTGRES_PASSWORD=...
graphql-engine:
image: hasura/graphql-engine:latest
depends_on:
- postgres
restart: always
environment:
- HASURA_GRAPHQL_DATABASE_URL=postgres://...:...@postgres:5432/postgres
- HASURA_GRAPHQL_ACCESS_KEY=...
- HASURA_GRAPHQL_AUTH_HOOK=http://host.docker.internal:3000/simple/webhook
command:
- graphql-engine
- serve
- --enable-console
ports:
- 8080:8080
volumes:
postgres:
data:
本地项目肯定在工作并侦听端口 3000。尽管如此,它没有从 graphql-engine 容器接收到任何请求 [应该]。会不会和我们代理有关?
似乎是 Docker 桌面的问题。
卸载了整个 docker 环境并重新构建,修复了它。
在构建 docker 容器之前,我正在本地处理我们的 webhook,并希望我的 (Linux) 容器使用 host.docker.internal:ping
.[=21= 与其通信]
它以前一直在工作,但最近,由于某种原因,我从我们的 graphql-engine
、Hasura 收到此错误:
{
"timestamp":"2019-11-05T18:45:32.860+0000",
"level":"error",
"type":"webhook-log",
"detail":{
"response":null,
"url":"http://host.docker.internal:3000/simple/webhook",
"method":"GET",
"http_error":{
"type":"http_exception",
"message":"ConnectionFailure Network.Socket.getAddrInfo (called with preferred socket type/protocol: AddrInfo {addrFlags = [AI_ADDRCONFIG], addrFamily = AF_UNSPEC, addrSocketType = Stream, addrProtocol = 0, addrAddress = <assumed to be undefined>, addrCanonName = <assumed to be undefined>}, host name: Just \"host.docker.internal\", service name: Just \"3000\"): does not exist (Temporary failure in name resolution)"
},
"status_code":null
}
}
这是我的 docker 撰写:
version: '3.6'
services:
postgres:
image: postgres:11.2
restart: always
ports:
- 5432:5432
volumes:
- postgres:/var/lib/postgresql/data
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=...
- POSTGRES_PASSWORD=...
graphql-engine:
image: hasura/graphql-engine:latest
depends_on:
- postgres
restart: always
environment:
- HASURA_GRAPHQL_DATABASE_URL=postgres://...:...@postgres:5432/postgres
- HASURA_GRAPHQL_ACCESS_KEY=...
- HASURA_GRAPHQL_AUTH_HOOK=http://host.docker.internal:3000/simple/webhook
command:
- graphql-engine
- serve
- --enable-console
ports:
- 8080:8080
volumes:
postgres:
data:
本地项目肯定在工作并侦听端口 3000。尽管如此,它没有从 graphql-engine 容器接收到任何请求 [应该]。会不会和我们代理有关?
似乎是 Docker 桌面的问题。 卸载了整个 docker 环境并重新构建,修复了它。