Gibbs
Gibbs

Reputation: 22974

Stop recently started container in docker?

   docker stop lastContainerName

It works fine. I want to stop it using docker ps -l command

   docker stop | docker ps -l

I tried this. Unfortunately docker stop --help getting executed.

Am i missing something? How to achieve this? Any Suggestions.

Upvotes: 0

Views: 72

Answers (1)

Bryan
Bryan

Reputation: 12200

It looks like what you are trying to do is to pipe the output of docker ps -l as an argument of the docker stop command. One way to do this in Unix is with back-quotes:

docker stop `docker ps -lq`

(I also added a -q option so you get just the ID with no column-names, etc.)

Upvotes: 1

Related Questions