Nextjs cannot run with docker..
Unanswered
Sun bear posted this in #help-forum
Sun bearOP
Hi I am using the dockerfile provided by nextjs but I keep getting this
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.14kB 0.0s
=> [internal] load metadata for docker.io/library/node:18-alpine 0.6s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 112B 0.0s
=> [internal] load build context 0.1s
=> => transferring context: 911.04kB 0.1s
=> [base 1/1] FROM docker.io/library/node:18-alpine@sha256:b1a0356f7d6b86c958a06949d3db3f7fb27f95f627aa6157cb98bc65c801efa2 0.0s
=> CACHED [builder 1/4] WORKDIR /app 0.0s
=> CACHED [runner 2/8] RUN addgroup --system --gid 1001 nodejs 0.0s
=> CACHED [runner 3/8] RUN adduser --system --uid 1001 nextjs 0.0s
=> CACHED [deps 1/4] RUN apk add --no-cache libc6-compat 0.0s
=> CACHED [deps 2/4] WORKDIR /app 0.0s
=> [deps 3/4] COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ 0.1s
=> ERROR [deps 4/4] RUN if [ -f yarn.lock ]; then yarn --frozen-lockfile; elif [ -f package-lock.json ]; then npm ci; elif [ -f pnpm-lock.yaml ]; then yarn global add pnp 19.9s
------
> [deps 4/4] RUN if [ -f yarn.lock ]; then yarn --frozen-lockfile; elif [ -f package-lock.json ]; then npm ci; elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; else echo "Lockfile not found." && exit 1; fi:
0.418 yarn install v1.22.19
0.528 [1/4] Resolving packages...
19.79 error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`.
19.79 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.2 Replies
Spectacled bear
Try adding the flag
--frozen-lockfile in the line of yarn install into the dockerfile, or try deleting the yarn.lock and yarn install to regenerate it.Toyger
remove your
yarn.lock file