Docker命令在Windows 7上不可用

时间:2022-11-03 02:13:16

So I am using Docker with boot2docker for quite some time on Windows, and everything works ok. Recently, it started bothering me that in order to run docker commands, I have to start Boot2Docker terminal, and type there boot2docker ssh, and from virtual machine run docker commands. What I find strange is that after starting Boot2Docker terminal(without ssh-ing into vm), this is the output:

所以我在Windows上使用Docker和boot2docker很长一段时间,一切正常。最近,它开始困扰我,为了运行docker命令,我必须启动Boot2Docker终端,并键入boot2docker ssh,并从虚拟机运行docker命令。我发现奇怪的是,启动Boot2Docker终端后(没有ssh到vm),这是输出:

initializing...
Virtual machine boot2docker-vm already exists

starting...
Waiting for VM and Docker daemon to start...
.o
Started.
Writing C:\Users\user\.boot2docker\certs\boot2docker-vm\ca.pem
Writing C:\Users\user\.boot2docker\certs\boot2docker-vm\cert.pem
Writing C:\Users\user\.boot2docker\certs\boot2docker-vm\key.pem

To connect the Docker client to the Docker daemon, please set:
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH='C:\Users\user\.boot2docker\certs\boot2do                      cker-vm'
    export DOCKER_TLS_VERIFY=1


IP address of docker VM:
192.168.59.103

setting environment variables ...
Writing C:\Users\user\.boot2docker\certs\boot2docker-vm\ca.pem
Writing C:\Users\user\.boot2docker\certs\boot2docker-vm\cert.pem
Writing C:\Users\user\.boot2docker\certs\boot2docker-vm\key.pem
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH='C:\\Users\\user\\.boot2docker\\certs\\bo                      ot2docker-vm'
    export DOCKER_TLS_VERIFY=1

You can now use `docker` directly, or `boot2docker ssh` to log into the VM.

After that, I can run boo2docker.exe ssh, and from vm docker command. However without ssh-ing:

之后,我可以运行boo2docker.exe ssh,并从vm docker命令运行。但是没有ssh-ing:

$ docker.exe
bash: docker.exe: command not found

Am I missing something?

我错过了什么吗?

3 个解决方案

#1


3  

Same issue here - docker toolbox install doesn't add docker to the path.

同样的问题 - docker toolbox install不会将docker添加到路径中。

Just manually add the docker.exe to your path - mine was installed to program files docker toolbox.

只需手动将docker.exe添加到您的路径中 - 我的程序文件已安装到docker工具箱中。

C:\Program Files\Docker Toolbox\

#2


0  

Firstly, why docker.exe? try only docker. Or rather, try docker version. If this works, you can use all the docker commands smoothly.

首先,为什么docker.exe?尝试只有码头工人。或者更确切地说,尝试docker版本。如果这样做,您可以顺利使用所有docker命令。

Secondly, Boot2Docker has been deprecated recently. Its much more simple now. : https://docs.docker.com/installation/windows/

其次,Boot2Docker最近已被弃用。它现在简单得多。 :https://docs.docker.com/installation/windows/

#3


0  

In my case, the installation had created a PATH user variable, as opposed to adding the docker.exe directory to the PATH system variable. I fixed the path manually and it worked.

在我的例子中,安装创建了一个PATH用户变量,而不是将docker.exe目录添加到PATH系统变量。我手动修复了路径并且工作正常。

#1


3  

Same issue here - docker toolbox install doesn't add docker to the path.

同样的问题 - docker toolbox install不会将docker添加到路径中。

Just manually add the docker.exe to your path - mine was installed to program files docker toolbox.

只需手动将docker.exe添加到您的路径中 - 我的程序文件已安装到docker工具箱中。

C:\Program Files\Docker Toolbox\

#2


0  

Firstly, why docker.exe? try only docker. Or rather, try docker version. If this works, you can use all the docker commands smoothly.

首先,为什么docker.exe?尝试只有码头工人。或者更确切地说,尝试docker版本。如果这样做,您可以顺利使用所有docker命令。

Secondly, Boot2Docker has been deprecated recently. Its much more simple now. : https://docs.docker.com/installation/windows/

其次,Boot2Docker最近已被弃用。它现在简单得多。 :https://docs.docker.com/installation/windows/

#3


0  

In my case, the installation had created a PATH user variable, as opposed to adding the docker.exe directory to the PATH system variable. I fixed the path manually and it worked.

在我的例子中,安装创建了一个PATH用户变量,而不是将docker.exe目录添加到PATH系统变量。我手动修复了路径并且工作正常。