为什么在 minikube VM 中无法访问 docker-daemon?
Why docker-daemon is not accessible in minikube VM?
我已经安装了 minikube 并使用它的默认虚拟机启动了它,所以基本上是使用 minikube start
启动了 minikube。在我通过 minikube ssh
访问的 minikube 虚拟机中,我试图在安装本地文件系统后构建我的 docker 文件,但它显示错误 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
我通过 systemctl show --property ActiveState docker
检查了 docker 的 ActiveState
,它显示失败,但 docker version
向我显示了所有正常的细节,如版本构建等。
这是我要执行的语句:$ sudo docker build --file=Dockerfile --tag=demo-backend:latest --rm=true .
我应该单独安装 docker 吗?如果不应该如何访问我系统中已经存在的 VM 中的 docker
似乎 docker 没有正常启动。
请尝试执行 sudo systemctl start docker
并让我知道是否是问题所在。
编辑:
从评论中添加更多信息以补充答案:
I had to set the docker environment variable to local instance of
docker running in minikube through this command: eval $(minikube
docker-env) and then restart the docker and all of this has to done in
the same shell in which i aim to access the docker otherwise it does
not works. this made me acces the docker from minikube – rehan
我已经安装了 minikube 并使用它的默认虚拟机启动了它,所以基本上是使用 minikube start
启动了 minikube。在我通过 minikube ssh
访问的 minikube 虚拟机中,我试图在安装本地文件系统后构建我的 docker 文件,但它显示错误 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
我通过 systemctl show --property ActiveState docker
检查了 docker 的 ActiveState
,它显示失败,但 docker version
向我显示了所有正常的细节,如版本构建等。
这是我要执行的语句:$ sudo docker build --file=Dockerfile --tag=demo-backend:latest --rm=true .
我应该单独安装 docker 吗?如果不应该如何访问我系统中已经存在的 VM 中的 docker
似乎 docker 没有正常启动。
请尝试执行 sudo systemctl start docker
并让我知道是否是问题所在。
编辑: 从评论中添加更多信息以补充答案:
I had to set the docker environment variable to local instance of docker running in minikube through this command: eval $(minikube docker-env) and then restart the docker and all of this has to done in the same shell in which i aim to access the docker otherwise it does not works. this made me acces the docker from minikube – rehan