How to remove an accessory in Kamal - A Troubleshooting Guide
There can be scenarios where you need to remove an accessory from your Kamal deployment. Let it be a conflict or a misconfiguration, you might need to remove an accessory to redeploy your application. This guide will help you understand how to remove an accessory and redeploy your application.
Now look at the error message below:
ERROR (SSHKit::Command::Failed): Exception while executing on host 192.168.0.1: docker exit status: 125
docker stdout: Nothing written
docker stderr: docker: Error response from daemon: Conflict. The container name "/kamal-demo-blog-db" is already in use by container "b59.....e25". You have to remove (or rename) that container to be able to reuse that name.
This error message indicates that the container name is already in use by another container and one way to resolve this is to remove the accessory and redeploy the application.
Remove the accessory
You can remove the accessory using the following command:
kamal accessory remove db
Note: since kamal generates the accessory name based on the application name, you dont need to specify the full accessory name.
In this case, the accessory name is kamal-demo-blog-db
but providing db
is sufficient.
Redeploy
After removing the accessory, you can redeploy the application using the following command:
kamal deploy