CircleCI caching data in MySQL Docker image on each build?



I’m trying to use library/mysql:5.7 as a database image for my CI testing. Part of that process involves setting up test fixture data in the system based on a predefined dataset (literally just a bunch of SQL files read from disk) on every run.

The problem is that it seems like CircleCI is caching the Docker image between runs; when I try and run a build, I get a SQL error complaining that I’m trying to add the same table multiple times, which isn’t what I want. I can get around this by adding CREATE/DROP DATABASE statements to every test, but that isn’t ideal given how it should be recreating the container on every new build…

(As an aside, I built my process out using the local CLI and that behaviour doesn’t exist there)


The image contents are only cached when you use Docker layer caching.

Are you defining the table in the env vars for that container? It could just be precreated for you.


Actually I think I have an idea…the CircleCI configuration for environment variables would override any others in the config.yml right? If I’m understanding how this works right it seems like it’s propagating the env vars for the global project configuration (including links to our old test database) into the new build and database containers and that’s causing the test scripts to fail to connect. Would that make sense?


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.