Justin
Justin

Reputation: 887

What does the operator $() mean in Docker

This is probably a pretty straight forward answer. I have Googled this in relation to the following command for Docker:

docker rm $(docker ps -a -q)

I looked for the operator in Go, Docker and Linux. It's obvious from the context it's some kind of pipe to the rm command but I'd love to know if it truly is some sort of pipe and why it isn't just docker rm | docker ps -a -q

Upvotes: 1

Views: 175

Answers (1)

Mureinik
Mureinik

Reputation: 310983

The $() operator isn't a docker operator, it's a bash operator which returns the output of the command between the parenthesis. So what you're doing here is running docker ps -a -q and then plugging the output of that command to docker run <output substituted here>.

Upvotes: 2

Related Questions