Windows 10 子系统安装docker,并解决Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 问题。
-
搜索框中搜索开发者设置
image.png
-
windows 设置打开开发者选项
image.png
-
搜索框中搜索windows功能
image.png
-
勾选使用于Linux的Windwos子系统
image.png
-
安装 Docker Desktop for Windows
下载地址:https://www.docker.com/products/docker-desktop
安装成功后打开 Expose daemon on tcp://localhost:2375 without TLS
-
在Microsoft Store中搜索Ubuntu,然后安装就行
image.png
-
Ubuntu安装成功后打开(第一次打开需要设置用户名和密码)
image.png
-
然后依次执行以下命令:
Docker 官网安装步骤: https://docs.docker.com/engine/install/ubuntu/ ,不想看官网的直接按照以下命令执行即可
$ sudo apt-get update
$ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo apt-key fingerprint 0EBFCD88
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt-get update
$ sudo apt-get install docker-ce
$ docker -H localhost:2375 images
$ export DOCKER_HOST=localhost:2375
$ echo "export DOCKER_HOST=localhost:2375" >> ~/.bashrc</pre>
到此docker就安装就成功了,可以愉快的玩耍了。
网友评论