@stephenb is correct. The one thing I would add is that the Elasticsearch docker image will run as user ID and group ID 1000. So make sure that this user owns the path.
For example:
mkdir /mnt/data0/elasticsearch && chown -R 1000:1000 /mnt/data0/elasticsearch
Then bind mount this path to the Elasticsearch container. The following example is from one of our docker compose files (you can also see how we mounted the path to certificates)...
volumes:
- /mnt/data0/elasticsearch:/usr/share/elasticsearch/data
- /etc/certs:/usr/share/elasticsearch/config/certificates