arangodb icon indicating copy to clipboard operation
arangodb copied to clipboard

Detect & remove obsolete server containers

Open anthonybriand opened this issue 7 years ago • 3 comments
trafficstars

Hello,

I have started a cluster of 3 instances of arangodb starter with the following commands (on the same server) :

docker run --detach --name=arangodb01-instance --rm -p 8528:8528 -v arangodb01:/data -v /var/run/docker.sock:/var/run/docker.sock arangodb/arangodb-starter --starter.address=XXX.XXX.XXX.XXX

docker run --detach --name=arangodb02-instance --rm -p8533:8528 -v arangodb02:/data -v /var/run/docker.sock:/var/run/docker.sock arangodb/arangodb-starter:latest --starter.address=XXX.XXX.XXX.XXX --starter.join=XXX.XXX.XXX.XXX

docker run --detach --name=arangodb03-instance --rm -p8538:8528 -v arangodb03:/data -v /var/run/docker.sock:/var/run/docker.sock arangodb/arangodb-starter:latest --starter.address=XXX.XXX.XXX.XXX --starter.join=XXX.XXX.XXX.XXX

But after I restarted my server, I can't restart with these commands because it says that the container already exists for agent, dbserver and coordinator, there is the logs :

arangodb01-instance :

2018/01/30 19:53:43 Starting arangodb version 0.10.4, build 553aab6
2018/01/30 19:53:43 Relaunching service with id '7a3c600e' on XXX.XXX.XXX.XXX:8528...
2018/01/30 19:53:43 Listening on 0.0.0.0:8528 (XXX.XXX.XXX.XXX:8528)
2018/01/30 19:53:43 Looking for a running instance of agent on port 8531
2018/01/30 19:53:44 Starting agent on port 8531
2018/01/30 19:53:44 Looking for a running instance of dbserver on port 8530
2018/01/30 19:53:44 Starting dbserver on port 8530
2018/01/30 19:53:45 Looking for a running instance of coordinator on port 8529
2018/01/30 19:53:45 Starting coordinator on port 8529
2018/01/30 19:55:56 Error while starting agent: container already exists
2018/01/30 19:55:58 Error while starting dbserver: container already exists
2018/01/30 19:56:10 Error while starting coordinator: container already exists

arangodb02-instance :

2018/01/30 19:54:06 Starting arangodb version 0.10.4, build 553aab6
2018/01/30 19:54:06 Relaunching service with id '74671b8f' on XXX.XXX.XXX.XXX:8533...
2018/01/30 19:54:06 Listening on 0.0.0.0:8528 (XXX.XXX.XXX.XXX:8533)
2018/01/30 19:54:06 Looking for a running instance of agent on port 8536
2018/01/30 19:54:06 Starting agent on port 8536
2018/01/30 19:54:07 Looking for a running instance of dbserver on port 8535
2018/01/30 19:54:07 Starting dbserver on port 8535
2018/01/30 19:54:08 Looking for a running instance of coordinator on port 8534
2018/01/30 19:54:08 Starting coordinator on port 8534
2018/01/30 19:56:15 Error while starting agent: container already exists
2018/01/30 19:56:21 Error while starting dbserver: container already exists
2018/01/30 19:56:33 Error while starting coordinator: container already exists

arangodb03-instance :

2018/01/30 19:54:22 Starting arangodb version 0.10.4, build 553aab6
2018/01/30 19:54:22 Relaunching service with id '0efdca2c' on XXX.XXX.XXX.XXX:8538...
2018/01/30 19:54:22 Listening on 0.0.0.0:8528 (XXX.XXX.XXX.XXX:8538)
2018/01/30 19:54:22 Looking for a running instance of agent on port 8541
2018/01/30 19:54:22 Starting agent on port 8541
2018/01/30 19:54:23 Looking for a running instance of dbserver on port 8540
2018/01/30 19:54:23 Starting dbserver on port 8540
2018/01/30 19:54:24 Looking for a running instance of coordinator on port 8539
2018/01/30 19:54:24 Starting coordinator on port 8539
2018/01/30 19:56:30 Error while starting agent: container already exists
2018/01/30 19:56:37 Error while starting dbserver: container already exists
2018/01/30 19:56:48 Error while starting coordinator: container already exists

anthonybriand avatar Jan 30 '18 20:01 anthonybriand

Depending on the settings of your docker server process, it may leave behind containers when restarting (in exited state).

Please do the following:

Run docker ps -a and copy the output here.

If there are indeed left over container, use docker system prune to remove them.

ewoutp avatar Jan 31 '18 07:01 ewoutp

That's it sorry, after the docker system prune it restarted correctly, my bad

anthonybriand avatar Jan 31 '18 09:01 anthonybriand

No worries. I'll leave the issue open under a new name. We should investigate if we can solve problems like this automatically.

ewoutp avatar Feb 02 '18 06:02 ewoutp