docker-compose -f "test.docker-compose.yml" up -d --build
Creating network "docker_default" with the default driver
Creating docker_rootvolume-mount-test_1 ... error
ERROR: for docker_rootvolume-mount-test_1 Cannot create container for service rootvolume-mount-test: invalid volume specification: '/host_mnt/hostroot:ro'
ERROR: for rootvolume-mount-test Cannot create container for service rootvolume-mount-test: invalid volume specification: '/host_mnt/hostroot:ro'
ERROR: Encountered errors while bringing up the project.
Ah, this is because you do run docker-compose on windows and not inside the docker vm it uses to actualy run the containers. The docker-compose cli client does more magic than it’s linux counterpart. If you use the Windows docker-compose client, only the Hosts filesystem can be shared.
I thought docker compose is just a (advanced) wrapper around docker run to simplify long and complex run commands? I would expect it to work with compose if it works with run. So I have to write a script instead or is there a way to make docker compose work?
Docker-Compose is not realy a wrapper, it is a single node orchestrator that interacts with the Docker Engines api. Though on Windows, it has to do additional magic and orchestrate Hyper-V to actualy mount the local filesystem into the vm, and then let the engine bind it to a container.
I always felt the Windows and MacOS version of Docker are halfed assed, as they delegate everything to a minimum Linux vm. Most things work like they would on a native Linux system, though when it commes to volumes and networks, its a whole different beast.