How to Delete Remote Docker Containers

Hello everyone,

I’ve encountered some issues with separating the development/production databases in Wappler version 6.8.0. While trying to fix the error, I ended up creating multiple remote containers in Docker.

I’d like to know how I can delete these files.

For context, my production target is set up using Docker and Hetzner.

I can’t say for sure, but it seems that these extra projects are interfering with publishing my system to production.

Development:

Production after Deploy and Publish:

Hi @guilhermefaj,
Install Portainer in the Resource Manager, login to it, and then from there you can remove the Containers you no longer require. Probably the easiest way.

Thanks for your answer @Cheese

I’ve already tried that before.

After deleting the container with the same name, only one of the containers is removed in Wappler. The others don’t show up in Portainer. However, after deploying, the container reappears, and I end up with four containers again.

You can try via SSH:

1. List all Docker containers

First, you need to identify the containers you want to delete. Run the following command to list all containers, including those that are stopped:

docker ps -a

This command will show all containers, their status (running or stopped), and their IDs.

2. Stop a running container (if necessary)

If you want to delete a container that is currently running, you must stop it first. Use the following command, replacing <container_id> with the actual container ID or name:

docker stop <container_id>

3. Delete a container

To delete (remove) a container, use the following command, again replacing <container_id> with the appropriate container ID or name:

docker rm <container_id>

If you want to remove multiple containers at once, you can specify a list of IDs or use a wildcard:

docker rm <container_id_1> <container_id_2>

Or to remove all stopped containers:

docker container prune

4. Force remove a running container (optional)

If a container is running and you want to forcefully remove it, use the -f (force) flag:

docker rm -f <container_id>

You can also Prune using Wappler's Publish feature:

image

This will remove any unused/redundant Containers.

Unfortunately, none of the solutions worked, and it also ended up recreating the container I had deleted in Portainer.