<p>I run mysql and a simple spring boot app for just getting a data to store in db with just simple controller and repository class.</p>
<p>I have added some data. Then <strong>I stopped all containers and deleted images and volumes</strong></p>
<p>I run: <code>docker system prune --volumes -a</code> and when I run <code>docker system df</code> the output is:</p>
<pre><code>TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          0         0         0B        0B
Containers      0         0         0B        0B
Local Volumes   0         0         0B        0B
Build Cache     0         0         0B        0B
</code></pre>
<p>As far as I understand there is nothing on pc except docker's itself.</p>
<p>But when I run my <strong>docker-compose.yml</strong> file with <code>docker-compose up -d</code></p>
<p>It is downloading new image of mysql and building my app from it's docker file, but when I inspect the db, still I see old data in db. Here is my <strong>docker-compose.yml</strong> file:</p>
<pre><code>version: '3.9'

services:
  mysql:
    platform: linux/amd64
    image: mysql:8
    container_name: mysqlcustomerdb
    restart: always
    ports:
      - '3306:3306'
    volumes:
      - ~/apps/mysql:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=1234
      - MYSQL_PASSWORD=1234
      - MYSQL_DATABASE=mysqlcustomerdb
      - DATABASE_HOST=mysqlcustomerdb
      - MYSQL_ROOT_HOST=%
      - lower_case_table_names=1
      - init-connect='GRANT CREATE USER ON . TO 'root'@'%';FLUSH PRIVILEGES;'

  dockerdeneme:
    container_name: dockerdeneme
    image: dockerdeneme
    build: ./
    restart: always
    deploy:
      restart_policy:
        condition: on-failure
        delay: 10s
        max_attempts: 3
        window: 120s
    ports:
      - '8080:8080'
    environment:
      - MYSQL_ROOT_PASSWORD=1234
      - MYSQL_PASSWORD=1234
      - MYSQL_USER=root
      - MYSQL_DATABASE=mysqlcustomerdb
    depends_on:
      - mysql
volumes:
  cache:
    driver: local
</code></pre>
<p>Why do the old data that I added to db is still coming even if I run <code>docker system prune --volumes -a</code> ? Am I missing some commands in docker compose file to refresh db or do I need to clear some folders from project etc ?</p>

abidinberkay
<p>You're mounting a directory on the host into /var/lib/mysql. Since it's not a docker volume, you can't see it using docker commands.</p>
<p>Delete the contents of <code>~/apps/mysql</code> on the host and your data should be gone.</p>
