Code Monkey home page Code Monkey logo

Comments (6)

bytemain avatar bytemain commented on June 19, 2024

你说的应该是 wsl2.ps1 这个文件里的,因为 powershell 脚本在执行的时候会转义 $ 这个字符 所以 `$ 可以让 $ 不被转义。

在 bash 中直接执行 ip route | grep default | awk '{print $3}' 即可

from dotfiles.

fawdlstty avatar fawdlstty commented on June 19, 2024

直接执行脚本也需要这么改呀,,,

from dotfiles.

bytemain avatar bytemain commented on June 19, 2024

哈哈 我这里是通过 pwsh 里调用 bash.exe -c {语句}

所以要让这里的 {语句} 里的内容都转义正确

from dotfiles.

fawdlstty avatar fawdlstty commented on June 19, 2024

貌似我又发现一个神奇的问题,wsl.local在宿主只能ping通,这功能我是想着转发kubernetes dashboard,然后:

fa@FAWDLSTTY-PC:/mnt/c/Users/fawdlstty$ minikube dashboard
🤔  Verifying dashboard health ...
🚀  Launching proxy ...
🤔  Verifying proxy health ...
🎉  Opening http://127.0.0.1:43909/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...
👉  http://127.0.0.1:43909/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/

我将这个地址换成wsl.local访问不了,ip也不行,但wsl2内能访问。是否还缺一个设置?

from dotfiles.

bytemain avatar bytemain commented on June 19, 2024

wsl2 能访问是因为它会向主机查询 dns(因为 nameserver 指向了 windows 主机),主机会把 hosts 中的域名直接缓存起来然后直接作为一个 dns 记录。

docker 可能不走这个设置,可能需要手动设置一下 dns 的地址为主机(我没试过)....

from dotfiles.

fawdlstty avatar fawdlstty commented on June 19, 2024

谢谢,我再看看

from dotfiles.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.