I am running some containers, defined by a docker-compose file and the containers are already used in production.
I found out that one of the containers (odoo) is using a data directory where it places some process-related files which are important and should be saved.
Unfortunately, I forgot to use a volume for the data to make it persistent and want to do it now.
I tried to edit the docker-compose.yml
file and define a volume in the odoo service like:
volumes:
- odoo_web_data:/var/lib/odoo
and run
docker-compose up -d
to recreate the container.
This would work if the container were initially created, however, all I am getting now is a warning:
WARNING: Service "odoo" is using volume "/var/lib/odoo" from the previous container. Host mapping "user_odoo_customer_web_data" has no effect. Remove the existing containers (with
docker-compose rm odoo-customer
) to use the host volume mapping.
I guess this means that it cannot be mounted, due to the folder being non-empty and linked to the previous instance of the container.
How can I persistently mount a folder from a running container on the host?