docker容器无权访问localhost webhook

在构建docker容器之前,我正在本地处理Webhook,并希望我的(Linux)容器使用host.docker.internal:ping与之通信。
它以前一直在工作,但是最近,由于某种原因,我从我们的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
   }
}   

这是我的码头工人组成:

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容器接收任何请求(应有)。可能与我们的代理有关吗?

zhouwangluo 回答:docker容器无权访问localhost webhook

似乎是Docker Desktop的问题。 卸载整个docker环境并重新构建,修复了它。

本文链接:https://www.f2er.com/3152505.html

大家都在问