colima: Unable to write to bind mount
colima version 0.2.2
git commit: b2c7697bee2d73e995f156fe8e9870eb246c07e6
runtime: docker
client: v20.10.12
server: v20.10.7
uname -a
Darwin <REDACTED> 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64 x86_64
When bind mounting a volume on the host, the filesystem is read only despite using docker functionality to allow for writing to the host
Steps to reproduce
Note that :Z
is added to the -v
parameter.
docker run -v "$(PWD):/output:Z" bash:latest touch /output/foo.txt
touch: cannot touch '/output/foo.txt': Read-only file system
I’ve also tried
4. docker run -v "$(PWD)/output:z" bash touch /output/foo.txt
4. docker run -v "$(PWD)/output:rw" bash touch /output/foo.txt
3. docker run --privileged -v "$(PWD):/output:Z" bash touch /output/foo.txt
4. docker run -v "$(PWD)/output:rw" --group-add=dialout bash touch /output/foo.txt
5. sudo docker run -v "$(PWD)/output:rw" --group-add=dialout bash touch /output/foo.txt
With the same error
Files appear to be owned by 502:dialout
docker run -v "$(PWD)/CAD:/output:rw" bash ls -al /output
total 260
-rw-r--r-- 1 502 dialout 50758 Jan 7 02:48 MPB2015 Feet v4.f3d
-rw-r--r-- 1 502 dialout 212684 Jan 7 02:42 MPB2015-Feet.stl
Is this a known limitation? A bug? Or a misconfiguration on my part? Any guidance appreciated.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 26 (4 by maintainers)
When mounting Postgres data, they will be an error. Seems like the same issue.
chown: changing ownership of '/var/lib/postgresql/data': Permission denied
Please provide a solution - how to create volumes that will be mapped to the host directory. I mean to $HOME/some/directory/postgres-data.
Used to be read-only, but changed to writable in version 0.3.0.
@spuder kindly update colima and lima and try again.
It’s working now after running
colima delete
andcolima start
Thank you for your ideas. I used k3d to keep the setup as simple as possible. I don’t want to introduce another level of complexity because a developer, who should use the setup in his daily business should be able to focus on developing features and not on infrastructure. This is why the host path solution is preferred. Also it’s almost the same like the good old docker-compose setup. Anyways would be great if root cause in NixOS gets fixed as soon as possible 😉
@HansG89 maybe you can use a light storage provider (like https://rook.io or https://longhorn.io) to create k8s persistent volumes? Otherwise is should also be possible to use NFS or other network storage option for k8s volumes. Using local mount paths in k8s is always a dev workaround IMHO, because in production you almost always go with persistent volumes.
I just upgraded colima and lima, but I"m not seeing that bind mounts don’t work at all
I’ve reproduced this twice now and I’m pretty sure this is a regression