I'm running Docker v 17.09.0-ce
on Windows 10
. 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)
. Without the -a
flag the error looks like this:
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). To use this syntax on a Windows system, you need to use a bash shell rather than the powershell or command prompt.
docker restart $(docker ps -a)
wouldn't work on Linux either. I think you're looking for docker restart $(docker ps -aq)
(with "quiet" flag) - this works great in Powershell too.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.