Persist data in virtualbox image

I am using docker toolbox for windows.

I followed docker “getting started” documentation, and ended up with following .yml file.

version: "3"
services:
  web:
    image: yasar11732/get-started:part2
    deploy:
      replicas: 5
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      restart_policy:
        condition: on-failure
    ports:
      - "80:80"
    networks:
      - webnet
  visualizer:
    image: dockersamples/visualizer:stable
    ports:
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
    deploy:
      placement:
        constraints: [node.role == manager]
    networks:
      - webnet
  redis:
    image: redis
    ports:
      - "6379:6379"
    volumes:
      - "/home/docker/data:/data"
    deploy:
      placement:
        constraints: [node.role == manager]
    command: redis-server --appendonly yes
    networks:
      - webnet
networks:
  webnet:

if I docker-machine ssh default "mkdir ./data" before calling docker stack deploy command, redis container works as expected.

However, if I docker-machine stop default and docker-machine start default, /data folder is gone forever.

I have tried creating a volume with docker volume create redis-vol and change volumes line accordingly, but redis container failed to start afterwards.

How can I use containers that act as a database without losing my data?

Source: StackOverflow