For example I use this command to list all containers of name django project
docker ps -q --filter "status = exited" --filter "name = django_project"
Problem is that I can't remove the first line of output that looks like
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES and I want to use xargs to do things on my containers.
Googling. Really hard. But I didn't find any elegant looking answer. I can do it using variable and trimming that first line but I want to keep my code as short as possible.
CodePudding user response:
Use
docker ps -q --filter "status = exited" --filter "name = django_project" | tail -n 2 | xargs ...
to remove the first line of output