【问题标题】:cannot access docker on wsl2 with its IP address无法使用其 IP 地址访问 wsl2 上的 docker
【发布时间】:2022-01-03 14:49:50
【问题描述】:

我正在尝试关注: https://dev.to/_nicolas_louis_/how-to-run-docker-on-windows-without-docker-desktop-hik 为了在 Windows 的 wsl2 上使用 docker。

我可以通过这个调用启动一个 docker 容器:

docker -H 127.0.0.1 run --rm hello-world

但是,当我通过以下方式获取 IP 地址时:

echo `ifconfig eth0 | grep -E "([0-9]{1,3}.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d:`

并尝试使用以下命令启动容器:

docker -H 172.26.110.78 run --rm hello-world

我收到以下错误:

docker: Cannot connect to the Docker daemon at tcp://172.26.110.78:2375. Is the docker daemon running?.

显然,Ping 有效,docker 守护进程运行。

我可以做些什么来解决这个问题?

【问题讨论】:

    标签: docker windows-subsystem-for-linux wsl-2


    【解决方案1】:

    尝试重新启动您的 docker 容器,因为它可能未在正常状态下运行。 使用:

     docker restart [OPTIONS] CONTAINER [CONTAINER...]
    

    例如:

    docker restart hello_world
    

    【讨论】:

    • 重启了好几次都没成功。
    猜你喜欢
    • 2022-11-01
    • 2021-04-07
    • 2014-11-04
    • 2023-03-09
    • 2017-08-07
    • 1970-01-01
    • 2018-05-09
    • 2015-08-17
    • 2014-07-26
    相关资源
    最近更新 更多