Read-only filesystem error when running dev inside docker container
Unanswered
Oak apple gall wasp posted this in #help-forum
Oak apple gall waspOP
Hello! I am using Yarn 4 to manage the packages for my NextJS project. More specifically I'm using the zero-install configuration of Yarn 4, which uses Yarn's PnP and also caches all of the downloaded packages locally within the project folder (at
./.yarn/cache
). This works fine for the most part, but when I try to run yarn dev
within a docker container it seems to encounter a readonly filesystem error. Any ideas?4 Replies
Oak apple gall waspOP
this is the relevant part of my dockerfile:
# BASE STAGE
FROM node:20-alpine AS base
WORKDIR /opt/playtogether
# Configuration options
ARG PORT=8080
ENV YARN_VERSION=4.5.1
# Disable telemetry
ENV NEXT_TELEMETRY_DISABLED=1
# Set port defaulting to 8080
ENV PORT=$PORT
EXPOSE $PORT
# Update dependencies, add libc6-compat and dumb-init to the base image.
# dumb-init used to avoid running with PID 1
# https://github.com/Yelp/dumb-init
RUN apk update && apk upgrade && apk add --no-cache libc6-compat && apk add dumb-init
# Install and use Yarn Modern
RUN corepack enable && corepack prepare yarn@$YARN_VERSION
# DEVELOPMENT STAGE
FROM base AS dev
# Set node environment to development
ENV NODE_ENV=development
# Copy source files (includes packages due to zero-install)
COPY . .
# Verify packages
RUN yarn
# Start the development server
CMD ["dumb-init", "yarn", "dev"]
docker compose build
works fine, its just the docker compose up
that encounters the error (since thats when it tries to run yarn dev
)Oak apple gall waspOP
oh im also using docker desktop on windows 11, in case that matters
Oak apple gall waspOP
does anyone know what swc package is or why its trying to fall back onto it? or why its not using yarn's cache directory for it instead of the explicit path
/node_modules/...
? im assuming thats the problem since thats a path that doesnt exist and also wouldnt have write access