It's very common in the Laravel community to use SQLite in-memory for phpunit tests. However, sometimes you may need functionality that differ between MySQL and SQLite. Not writing test for that or struggling to find a compatible SQL operation for the two databases are options that I consider less than ideal. We can instruct Docker to mount a file system that will only be persisted on memory database: image: mysql:5.7 ports: - "3306:3306" environment: - MYSQL_DATABASE={your_default_database} tmpfs: - /var/lib/mysql:rw Setting up /var/lib/mysql as a read-write temporary file system will instruct docker to skip the local storage and only mount the volume in memory, speeding up it's storage manipulation.