Search code examples
dockerboot2docker

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.


Solution

  • 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.)