I have a very simple shell script that should remove floating docker images, the command for this is:
docker rmi $(docker images -f "dangling=true" -q)
Now I'm running into an issue which I think is caused by the
$. I might be wrong though.
My script is this:
#!/bin/bash cd /Users/jared/Projects for d in ./*/ ; do (cd "$d" && docker rmi $(docker images -f "dangling=true" -q); true); done
When I run this though, it prints out to the screen:
"docker rmi" requires at least 1 argument.
See 'docker rmi --help'.
Usage: docker rmi [OPTIONS] IMAGE [IMAGE...]
Remove one or more images
I'm making an assumption that's because of the
$(docker imag...) part and of course
$ is a special character.
How do I go about escaping or at least getting my script to behave in the way I would like?