Docker container to connect to Postgres not in docker

后端 未结 2 1897
温柔的废话
温柔的废话 2021-01-26 15:40

I have a .NET application running on a windows 10 computer using docker and postgres. When I run using the

 "DockerTest": {
      "commandName"         


        
相关标签:
2条回答
  • 2021-01-26 16:20

    Have you tried with hos ip as your PostgreSQL host. I have just tested with asp.net core 3.1 and PostgreSQL both in windows 10 docker Linux separate container.

    Its running without issue.

    my connection string is

    optionsBuilder.UseNpgsql("HOST=192.168.1.100;DataBase=TestIdentity;UserName=postgres;Password=*****;");

    0 讨论(0)
  • 2021-01-26 16:25

    docker run --name=XXX -d -p 8081:8081 --add-host=computername:IP address name This was what finally make it work

    0 讨论(0)
提交回复
热议问题