简体   繁体   English

运行docker命令时出现bash语法错误

[英]bash syntax error while running docker command

I was getting an error while running the docker ps command which is - 运行docker ps命令时出现错误-

> An error occurred trying to connect: Get
> http://localhost:2375/v1.21/containers/json?all=1: dial tcp
> 127.0.0.1:2375: ConnectEx tcp: No connection could be made because the target machine actively refused it.

I was trying to correct the error using the instruction present in this forum - https://forums.docker.com/t/windows-an-error-occurred-trying-to-connect/4384 我正在尝试使用此论坛中的说明纠正错误-https: //forums.docker.com/t/windows-an-error-occurred-trying-to-connect/4384

I am facing an error in the last step ie running this command in git bash - 我在最后一步遇到错误,即在git bash中运行此命令-

FOR /f "tokens=*" %i IN ('"C:\Program Files\Docker Toolbox\docker-machine.exe" env --shell cmd machinename') DO %i

The error which I get is 我得到的错误是

bash: syntax error near unexpected token `('

Any help to solve this issue? 对解决此问题有帮助吗? I tried to escape the single and double quotes and that didn't work. 我试图转义单引号和双引号,但没有用。

I am facing an error in the last step ie running this command in git bash - 我在最后一步遇到错误,即在git bash中运行此命令-

 FOR /f "tokens=*" %i IN ('"C:\\Program Files\\Docker Toolbox\\docker-machine.exe" env --shell cmd machinename') DO %i 

This is batch syntax, in bash this should work: 这是batch语法,在bash应该起作用:

eval `docker-machine env`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM