[英]Docker embed commands usage on Windows
I'm running Docker v 17.09.0-ce
on Windows 10
. 我正在Windows 10
上运行Docker v 17.09.0-ce
。 When I try to run embed commands like this: docker restart $(docker ps -a)
it throws me the error: unknown shorthand flag: 'a' in -a)
. 当我尝试运行这样的嵌入命令时: docker restart $(docker ps -a)
会抛出错误: unknown shorthand flag: 'a' in -a)
。 Without the -a
flag the error looks like this: 如果没有-a
标志,则错误如下所示:
Error response from daemon: No such container: $(docker
Error response from daemon: No such container: ps)
These kind of embed commands suggestions are widespread across the web. 这些嵌入命令建议在网络上很普遍。 How do I make it working? 我该如何运作?
The $(docker ps -a)
is a bash syntax (along with other common shells on Linux). $(docker ps -a)
是bash语法(以及Linux上的其他常见shell)。 To use this syntax on a Windows system, you need to use a bash shell rather than the powershell or command prompt. 要在Windows系统上使用此语法,您需要使用bash shell而不是powershell或命令提示符。
docker restart $(docker ps -a)
wouldn't work on Linux either. docker restart $(docker ps -a)
在Linux上也不起作用。 I think you're looking for docker restart $(docker ps -aq)
(with "quiet" flag) - this works great in Powershell too. 我认为您正在寻找docker restart $(docker ps -aq)
(带有“ quiet”标志)-在Powershell中也很好用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.