nextjs - ✅(Solved) Fix Docs: Docker build fails with TLS error when installing libc6-compat in Next.js multi-env example [1 pull requests, 7 comments, 4 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#91458Fetched 2026-04-08 00:47:02
View on GitHub
Comments
7
Participants
4
Timeline
19
Reactions
0
Author
Assignees
Timeline (top)
commented ×7labeled ×2mentioned ×2subscribed ×2

Error Message

[deps 1/4] RUN apk add --no-cache libc6-compat: 60.51 WARNING: fetching https://dl-cdn.alpinelinux.org/alpine/v3.23/main/x86_64/APKINDEX.tar.gz : TLS: unspecified error 120.6 WARNING: fetching https://dl-cdn.alpinelinux.org/alpine/v3.23/community/x86_64/APKINDEX.tar.gz : TLS: unspecified error 120.6 ERROR: unable to select packages: 120.6 libc6-compat (no such package): 120.6 required by: world[libc6-compat] failed to solve: process "/bin/sh -c apk add --no-cache libc6-compat" did not complete successfully: exit code: 1

Fix Action

Fixed

PR fix notes

PR #91463: example: update with-docker-multi-env Dockerfiles to match with-docker

Description (problem / solution / changelog)

Closes: https://github.com/vercel/next.js/issues/91458

Changed files

  • examples/with-docker-multi-env/docker/development/Dockerfile (modified, +48/-28)
  • examples/with-docker-multi-env/docker/production/Dockerfile (modified, +47/-28)
  • examples/with-docker-multi-env/docker/staging/Dockerfile (modified, +47/-28)

Code Example

> [deps 1/4] RUN apk add --no-cache libc6-compat:
60.51 WARNING: fetching https://dl-cdn.alpinelinux.org/alpine/v3.23/main/x86_64/APKINDEX.tar.gz : TLS: unspecified error
120.6 WARNING: fetching https://dl-cdn.alpinelinux.org/alpine/v3.23/community/x86_64/APKINDEX.tar.gz : TLS: unspecified error
120.6 ERROR: unable to select packages:
120.6   libc6-compat (no such package):
120.6     required by: world[libc6-compat]
failed to solve: process "/bin/sh -c apk add --no-cache libc6-compat" did not complete successfully: exit code: 1

---

FROM node:20-alpine AS base
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app

COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
RUN \
  if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
  elif [ -f package-lock.json ]; then npm ci; \
  elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i; \
  else echo "Lockfile not found." && exit 1; \
  fi


FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
COPY .env.production.sample .env.production
RUN npm run build


FROM base AS runner
WORKDIR /app

ENV NODE_ENV=production

RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001

COPY --from=builder /app/public ./public


COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000

ENV PORT=3000

ENV HOSTNAME=0.0.0.0
CMD ["node", "server.js"]
RAW_BUFFERClick to expand / collapse

What is the documentation issue?

When following the official with-docker-multi-env example from the Next.js repository, the Docker build fails during the installation of libc6-compat with a TLS error from Alpine Linux repositories.

Is there any context that might help us understand?

Environment Next.js version: 15.5.3 Docker version: version 29.3.0, build 5927d80 OS: Ubuntu Architecture: x86_64

Steps to Reproduce Navigate to with-docker-multi-env

Expected Behavior Docker image builds successfully without errors. which is what had been happenening prior but for the past three days i been having errors whre the build failes with the following 👇🏿👇🏿

> [deps 1/4] RUN apk add --no-cache libc6-compat:
60.51 WARNING: fetching https://dl-cdn.alpinelinux.org/alpine/v3.23/main/x86_64/APKINDEX.tar.gz : TLS: unspecified error
120.6 WARNING: fetching https://dl-cdn.alpinelinux.org/alpine/v3.23/community/x86_64/APKINDEX.tar.gz : TLS: unspecified error
120.6 ERROR: unable to select packages:
120.6   libc6-compat (no such package):
120.6     required by: world[libc6-compat]
failed to solve: process "/bin/sh -c apk add --no-cache libc6-compat" did not complete successfully: exit code: 1

Dockerfile This is my complete Dockerfile i use whch is pretty much the exact thing i copied from the repo

FROM node:20-alpine AS base
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app

COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
RUN \
  if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
  elif [ -f package-lock.json ]; then npm ci; \
  elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i; \
  else echo "Lockfile not found." && exit 1; \
  fi


FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
COPY .env.production.sample .env.production
RUN npm run build


FROM base AS runner
WORKDIR /app

ENV NODE_ENV=production

RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001

COPY --from=builder /app/public ./public


COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000

ENV PORT=3000

ENV HOSTNAME=0.0.0.0
CMD ["node", "server.js"]

Troubleshooting Attempted

  • The error appears to be network/SSL related (TLS: unspecified error)
  • RUN apk add --no-cache gcompat
  • Issue occurs specifically when trying to fetch from Alpine repositories
  • The package libc6-compat exists in Alpine repositories, but the TLS handshake fails

Does the docs page already exist? Please link to it.

https://github.com/vercel/next.js/blob/canary/examples/with-docker-multi-env/docker/production/Dockerfile

extent analysis

Fix Plan

The issue is caused by a TLS error when fetching from Alpine repositories. To fix this, we can update the Dockerfile to use a different repository or disable TLS verification.

  • Update the apk command to use a different repository:
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.17/main libc6-compat

Alternatively, you can disable TLS verification by adding the following line before the apk command:

RUN apk update && echo "--allow-untrusted" >> /etc/apk/repositories

However, disabling TLS verification is not recommended as it can pose a security risk.

Verification

To verify that the fix worked, rebuild the Docker image and check that the libc6-compat package is installed successfully.

Extra Tips

  • Make sure to update the apk command to use the correct repository version.
  • If you're behind a proxy, ensure that the proxy settings are configured correctly in the Dockerfile.
  • Consider pinning the libc6-compat package version to avoid any potential issues with future updates.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING