Why the containers are being recreated and they can not be removed

I installed from here a simple training application https://github.com/dockersamples/example-voting-app
After that i want to remove working containers and then images of this app. I`m trying type this:

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

First everything is deleted, but then the containers are restarted and recreated automatically even though I deleted this folder from the computer with the application. And have this error

Error response from daemon: You cannot remove a running container

Probably autostart is registered in docker-compose-files, but I already deleted the folder with this project from my mac

Every time i have 3 this running containers :
dockersamples/visualizer:stable “npm start” vote_vis
dockersamples/examplevotingapp_result:before "node server.vote_res
postgres:9.4 "docker-entry vote_db.

How can i fix it and delete everything?

Hi :slight_smile:

You most likely started it using the swarm option in that guide?
If so, you have created a one-node “cluster”, and told that cluster that you ALWAYS want 1 of these services.

To check, you can use:

docker stack ls

This will display the running stacks ( stacks is a group of services, and a service is a container in the swarm mode )

If the “docker stack ls” outputs something, you can use:

docker stack rm STACK-NAME-FROM-OUTPUT

And that will kill the stack :slight_smile:

Bonus:
If you want to check the services in your stack, you can use:

docker stack ps STACK-NAME-FROM-OUTPUT