Assuming the use of a compose file such as the following with a managed volume
services:
mc:
# ...
volumes:
- mc-data:/data
volumes:
mc-data: {}
Copy the data volume's content to a relative directory
docker compose cp mc:/data ./data
Change the volume entry to
services:
mc:
# ...
volumes:
- ./data:/data