I was treing to set the project on my local machine as readonly for the docker container, like this:
docker run -d \
-p 3000:3000 \
-v $PWD:/app:ro \
-v /app/node_modules \
--name $1 \
$(docker images | awk '{print $1}' | awk 'NR==2')
and I always get this error, only after I add the :ro
bit as the optional parameter to the volume:
docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:75: mounting "/var/lib/docker/volumes/6ffd471c1bc7edc141b6569b4d8e16829c7c7ae1838e4cc924727b0a854de143/_data" to rootfs at "/app/node_modules" caused: mkdir /var/lib/docker/overlay2/60b790308084302171b1b339ee242862651d7d96ecf21fb9b0a8867326ca83b3/merged/app/node_modules: read-only file system: unknown.
I was following this tutorial and I am using docker-desktop
and WSL2
on windows 11
.