dockerdocker-swarm

How to remove all services in Docker Swarm


I want to remove all services I created in a Swarm:
enter image description here

To remove all the containers I used:

docker rm -f $(docker ps -a -q)

Is there a way to remove all the service with one line ?

I don't have a stack:
enter image description here
so docker stack rm STACK_NAME won't work.


Solution

  • The same solution exists in services:

    docker service rm $(docker service ls -q)