-
-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to write to bind mount #102
Comments
I suspect this is a lima problem Looking at ~/.lima/default/lima.yaml` the default settings are:
I don't know if this quite translates to the problem that I am seeing, but it does seem like a plausible correlation. |
@spuder version 0.2.2 do not mount home directory as writeable by default, kindly install the latest development version with |
While I no longer get the error
|
I've uncovered some sort of race condition, because I'm now able to ❌
Does lima\colima sync the file system periodically? I find that If I put a sleep between the If I write a file with a unique name, it always works ✅
It seems like when you create/delete a file with lima/colima it is caching that file for a few seconds so you can't immediately write a file with the same name. |
I've been tinkering with stuff around this issue to see if I can get any better results but have been as yet unsuccessful |
When mounting Postgres data, they will be an error. Seems like the same issue. |
Yes - I too have the same issue with the following
I'm using the latest |
@spuder kindly update colima and lima and try again.
|
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 |
I'm able to reproduce the issue as well. I'm running: But when I look at mounts:
- location: /Users/john/Library/Caches/colima
writable: false
- location: /Users/john/IdeaProjects/
writable: false I'm running colima 0.3.2 |
@john-ot You do not need to specify the |
Ack! I will fix the syntax. Does the default mount give me write access though? I thought it was read only by default? |
Used to be read-only, but changed to writable in version 0.3.0. |
I'm facing the same issue. |
Just a quick update: I was able to solve this for some use cases. e.g. for the last docker-compose file use the volume
So use This issue is REALLY intereseting, becaus the error only happens, if a container tries to perform a build script ( #!/bin/bash
VERSION=$(git describe --always --dirty --tags)
CONTAINER=$(basename $PWD)
GID=$(id -g)
echo "building for $USER ($UID:$GID)"
export UID
export GID
export USER
docker build --build-arg USER --build-arg UID --build-arg GID -t ${CONTAINER}:${VERSION} . Dockerfile:
|
Please provide a solution - how to create volumes that will be mapped to the host directory. I mean to $HOME/some/directory/postgres-data. |
@yinshangwei @phaus suggested the workarounds 1) to use a VM-only volume instead of a host-mounted directory, or 2) don't use |
so from my side, this issue can be closed. |
any ideas on how to fix this issue when running local k3d kubernetes in colima and providing a host path storage to a pod? Colima is running with default settings, so home direcotry is mounted as writable. ALso told k3d to mount the home directory. I tested touching a file to a mounted volume inside a pod and it works as expected. Only chowning a folder seems to cause trouble. So for instance the postgres example gives me: config map: apiVersion: v1
kind: ConfigMap
metadata:
name: postgres-config
namespace: basys
labels:
app: postgres
data:
POSTGRES_DB: postgresdb
POSTGRES_USER: admin
POSTGRES_PASSWORD: test123
PGDATA: /var/lib/postgresql/data/pgdata storage: kind: PersistentVolume
apiVersion: v1
metadata:
name: postgres-pv-volume
labels:
type: local
app: postgres
spec:
storageClassName: manual
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/Users/xxx/postgres/data"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: postgres-pv-claim
labels:
app: postgres
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi deployment: apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:14.1
imagePullPolicy: "IfNotPresent"
ports:
- containerPort: 5432
envFrom:
- configMapRef:
name: postgres-config
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgredb
readOnly: false
volumes:
- name: postgredb
persistentVolumeClaim:
claimName: postgres-pv-claim |
@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. |
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 😉 |
Try |
I'm having this difficulty as well. colima version 0.5.2. I need to mount rw to try hot reloading. |
It's working now after running |
Just to clarify, this issue is still open and Colima doesn't allow for changing ownership of files in host mounted directories? I'm seeing host mounted directories and files being owned by I'm using the short form for mounting volumes:
Is this still expected behavior until this issue is resolved?
|
By default only your home directory is set up as writable. You'll need to adjust your colima.yml to make the mount that you want writable. |
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.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
Is this a known limitation? A bug? Or a misconfiguration on my part? Any guidance appreciated.
The text was updated successfully, but these errors were encountered: