I found this instruction on piping commands in Windows CMD:
The "pipe" redirects the output of a program or command to a second program or command.
Syntax:
Command1 | Command2
[Source] (at the very bottom)
Yet docker ps -aq | docker start or any similar combination just returns errors.
The only working combination to start all stopped container works in PowerShell.
docker start $(docker ps -a -q -f "status=exited")
You can pipe into docker containers (-i), but you can't pipe arguments to the docker command itself.
In PowerShell use a loop for starting a list of stopped containers:
docker ps -a -q -f "status=exited" | ForEach-Object { docker start $_ }
In CMD use a loop for starting a list of stopped containers:
for /f "tokens=*" %i in ('docker ps -a -q -f "status=exited"') do docker start %i
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With