How can I use an ephemeral volume for a Docker container using an official MySQL image with docker-compose?

Viewed 2083

I'm using an official MySQL docker image (https://github.com/docker-library/mysql/blob/3288a66368f16deb6f2768ce373ab36f92553cfa/5.6/Dockerfile) with docker-compose and I would like its data to be wiped out upon restart. The default is that it retains its data between container restarts.

Here's my docker-compose.yml:

version: "2"
services:
  mydb:
    image: mysql:5.6
    environment:
        MYSQL_ROOT_PASSWORD: foo

When I use docker inspect on my container it shows its location on the host machine. How can I instead have it store the data inside the container? I do not want it to persist.

1 Answers
Related