Fail To Remove Postgres Volume
search cancel

Fail To Remove Postgres Volume

book

Article ID: 270250

calendar_today

Updated On:

Products

CA API Developer Portal

Issue/Introduction

After successfully migrating our portal implementation to mysql we attempt to remove the postgres volume by executing the following command as outlined in the documentation but it fails with the following:

- sudo docker volume rm portal_database-postgres-volume
Error response from daemon: remove portal_database-postgres-volume: volume is in use

Environment

CA API Developer Portal 5.x

 

Cause

Executing the following command showed that there were many portal containers in a 'Exited' state present on the system.  These would have been previously running containers which were no longer in use but still tied to the postgres volume.

- docker container ls -a

Resolution

We removed all containers which were present on the system but no longer running by executing the following command:

- docker container rm $(docker container ls -a -q)

 

We were then able to successfully execute the command to remove the postgres volume:

- sudo docker volume rm portal_database-postgres-volume