I couldn't resolve the question with Docker version 18.09 on macos using the above answers and tried again.
The only actual solution for me was using this docker-compose.yml
configuration:
version: '3.7'
...
services:
demo-service:
volumes:
- data-volume:/var/tmp/container-volume
volumes:
data-volume:
driver: local
driver_opts:
type: none
o: bind
device: /tmp/host-volume
After launching with docker-compose up
I finally had /tmp/host-volume
from macos shared as writeable volume from within the container:
> docker exec -it 1234 /bin/bash
bash-4.4$ df
Filesystem 1K-blocks Used Available Use% Mounted on
...
osxfs 488347692 464780044 21836472 96% /var/tmp/container-volume
Hope this helps others too.