Docker Community Forums

Share and learn in the Docker community.

Docker container keeping ephemeral data after container removal

(Thiago Lima) #1

Hi, I’m having a issue with docker that is bothering me very much. I’ve created a container using a mysql:latest image and I’ve created the necessary databases in order to migrate the data from my production app to a container environment.

But I’ve realized that I could not use mysql:latest since it wasn’t yet homologated by the app developers. So I’ve destroyed the container using docker rm. But, when I created the right container (mysql:5.5), I’ve noticed that my previously created database was still there. Even I’m not running docker commit or anything to persist these data.

I’m sharing some host folders with the container using -v. I’ve removed these folders and recreated them to check if it was something cached onto the filesystem but yet still the database keep persisting on the container removal after removal.

I’ve tried to remove the image and pull it again from dockerhub and I’m noticing that this “cache” is affecting also other containers that I’m lauching.

Is there anything I can do in order to clear this cache? I don’t know what else can I do…

I’m using Docker 1.12.0 on Ubuntu 16.04.1 LTS;
The command that I’m using to launch the containers are:
docker run -idt --name PandoraFMS-MySQL --network PandoraFMS --ip -v /mnt/pandorafms/mysql/var/lib/mysql:/var/lib/mysql -v /mnt/pandorafms/mysql/etc/mysql:/etc/mysql -e MYSQL_ROOT_PASSWORD=<SomeGoodPassword> -e MYSQL_DATABASE=pandora -e MYSQL_USER=pandora -e MYSQL_PASSWORD=<SomeGoodPassword> mysql:5.5

docker run -idt --name PandoraFMS-Console --network PandoraFMS -p 8022:8022 -p 8023:8023 --link PandoraFMS-MySQL:mysql -e PANDORA_DB_HOST= -e PANDORA_DB_PASSWORD=<SomeGoodPassword> -e PANDORA_DB_USER=pandora -e PANDORA_DB_NAME=pandora pandorafms/pandorafms-console:6