![](/img/trans.png)
[英]Laravel Sail - After installing laravel sail for an existing project on Windows10 WSL2 I keep getting a docker-composer error
[英]Cannot access wsl web app from windows after installing docker
在我安裝 docker 並重新啟動之前,我通過 WSL 從 windows 訪問在 Ubuntu 中運行的應用程序沒有任何問題。
我檢查了我的主機配置文件,它看起來像下面這樣:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
# Added by Docker Desktop
192.168.1.244 host.docker.internal
192.168.1.244 gateway.docker.internal
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
我注釋掉倒數第二行
# 127.0.0.1 kubernetes.docker.internal
並使用沖洗我的 dns
ipconfig /flushdns
但是,如果我嘗試訪問在 wsl 的端口 3001 上運行的節點應用程序,我的瀏覽器仍會顯示“無法訪問此頁面消息”
這不是節點或我的應用程序的問題,因為我能夠從 ubuntu 終端成功地 curl 我的應用程序
我可以通過簡單地將wsl的ip地址添加到我的主機文件中docker聲明上方來解決這個問題:
<ip address of wsl> localhost
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.