It’s a missing feature of docker-compose, here a workaround.
We need to fall back to the basic docker cp
command with some improvements: dynamically get the container id (the command between brackets more information here)
docker cp $(docker-compose ps -q CONTAINER-NAME):/file/path/inside/container.txt ./host/file/path.txt