Skip to content

Updating Next.js doesn't update your Node: how to patch it in Docker

Update/ 14 min read

Node.js patched 22.x, 24.x and 26.x on October 21, 2026, but npm never touches your runtime. Change the base image, rebuild with --pull, check node -v.

  • Node.js
  • Security
In this article (8)
  1. What Node.js fixed on October 21
  2. Why updating dependencies doesn't change your runtime
  3. Change the base image in your Dockerfile
  4. Rebuild, redeploy and check with node -v
  5. If you're still on Node 20
  6. Common mistakes
  7. Frequently asked questions
  8. Checklist

Updating Next.js doesn't change the Node version your app runs on: the runtime comes from your Docker base image or your hosting platform, not from package.json. To get the October 21, 2026 security fixes, move to 22.23.4, 24.22.1 or 26.12.1, or later, rebuild with --pull, redeploy, and check with node -v.

No matter how often you upgrade next, the Node your build installs can come from a pinned image or file. Here's what the release fixed, why npm never touches the runtime, how to change the base image in Docker and on other platforms, and what to do if you're still on Node 20.

What Node.js fixed on October 21

On Wednesday, October 21, 2026, Node.js shipped new versions of the 26.x, 24.x and 22.x lines that fix ten vulnerabilities (four high, three medium, three low), per the Node.js October 2026 security releases post. The patched versions are 22.23.4, 24.22.1 and 26.12.1.

The most serious is CVE-2026-111497 (high), in the Brotli decoder bundled with Node: per the advisory, an attacker who can supply Brotli data that your app decompresses with node:zlib can corrupt process memory, which can lead to a crash, disclosure of process memory, or remote code execution. The other three high-severity issues are network-related: dns.resolve truncating names that contain a NUL character (CVE-2026-105482) and two TLS certificate hostname bypasses (CVE-2026-105483 and CVE-2026-106069). The release also updates components that ship inside the binary, such as c-ares, the root certificates, OpenSSL (3.5.9 in 22.23.4) and Undici. None of that lives in your node_modules.

LinePatched (Oct 21)Latest on November 2StatusEnd of life
26.x26.12.126.13.0Active LTS since October 28April 30, 2029
24.x24.22.124.22.2Maintenance LTSApril 30, 2028
22.x22.23.422.23.4Maintenance LTSApril 30, 2027
20.xNone20.20.2 (March 24)End-of-LifeApril 30, 2026

Node.js 26.13.0 (October 28) moves 26.x to LTS, and its notes say nothing else changed from 26.12.1. 24.22.2, out the same day, brings V8 fixes and contains 24.22.1, which I confirmed by comparing the tags on GitHub. The "patched" column is the minimum; any later release of the line works. End-of-life dates come from the Node.js release schedule.

Node.js: patched versions from the October 21, 2026 releaselinepatchedlatest · Nov 2statusend of life26.x26.12.126.13.0Active LTSApr 30, 202926.13.0 = 26.12.1 + LTS metadata24.x24.22.124.22.2Maintenance LTSApr 30, 202824.22.2 (Oct 28): V8 fixes on top of 24.22.122.x22.23.422.23.4Maintenance LTSApr 30, 2027ships OpenSSL 3.5.9, SQLite 3.53.4 and undici 6.29.120.xno fix20.20.2End-of-LifeApr 30, 2026EOL: "always affected" when a security release occurspatched = the minimum; any later release of that line workssources: nodejs.org advisory of Oct 21, 2026 and github.com/nodejs/Release

Scroll the figure sideways to see all of it

A confession: my laptop, where I tested this article's code, runs Node 22.22.3, older than the fix. But the one that matters is production, and almost nobody checks that one.

Why updating dependencies doesn't change your runtime

Node isn't a dependency of your project: it's the program that runs it. npm install next@… rewrites package.json, the lockfile and node_modules, and nothing else; that's how the November 3 Next.js patch goes in, as I cover in what to do about the Next.js security release. Not even engines installs anything: the npm docs say that unless you set engine-strict, it only produces warnings. The node binary lives in your Docker base image, or in whatever your platform installs during the build.

In Docker you can see it in the layers. The official node:24.22.2-bookworm-slim image has five: Debian bookworm, the node user, the Node 24.22.2 binary, Yarn 1.22.22 and the entrypoint script. Yours sit on top, with node_modules and next. Upgrading next rewrites your layers; the Node layer only changes with the FROM line.

where Node lives in a Docker imageRUN npm run build.next/COPY . .your codeRUN npm cinode_modules/ · nextCOPY package*.json ./lockfileyour layerschange with npm installnpm install next@<v>FROM node:24.22.2-bookworm-slimCOPY docker-entrypoint.shentrypointRUN … yarnyarn 1.22.22RUN … nodenode 24.22.2RUN useradd … nodenode userdebian.sh … bookwormdebian bookwormbase imagechanges with the FROM line/usr/local/bin/nodeupgrading next rewrites your layers, not Node'sactual layers of node:24.22.2-bookworm-slim, read Nov 2, 2026 with imagetools inspect

Scroll the figure sideways to see all of it

You can see which Node a tag ships without pulling it, because the image stores the version in NODE_VERSION. This is what it returned on November 2:

$ docker buildx imagetools inspect node:24-bookworm-slim --format '{{json (index .Image "linux/amd64").Config.Env}}'
[
  "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
  "NODE_VERSION=24.22.2",
  "YARN_VERSION=1.22.22"
]
  1. docker buildx imagetools inspect shows an image's details from the registry (command reference). It doesn't need the Docker engine: mine doesn't start, and it still answered.
  2. --format is a Go template: index .Image "linux/amd64" picks one platform from the multi-platform tag, and .Config.Env is its environment.
  3. NODE_VERSION=24.22.2 is that tag's Node on that day. It's a floating tag, so tomorrow it may be another.

Railway with Nixpacks: the major version is not enough

If you deploy to Railway with Nixpacks ("builder": "NIXPACKS" in railway.json) and no Dockerfile, the build log only shows the major version, in a line like setup │ nodejs_24, npm-9_x, plus a .nixpacks/nixpkgs-<commit>.nix file. The exact patch version appears nowhere.

According to the Nixpacks Node provider source, an open range like "node": ">=18.18.0" resolves to the newest even version that fits, 24, and each major is tied to a nixpkgs commit: for 24, exactly 23f9169c…. At that commit, nixpkgs' v24.nix file says version = "24.10.0". The Nixpacks Node docs put it simply: only a major version can be specified.

In other words: according to those files, a Nixpacks build on Node 24 installs Node 24.10.0, older than 24.22.1, however often you upgrade next or redeploy. Don't assume it for your own app: check it with the startup log below, which prints the container's real version. There are two ways out: Railpack, which Railway made its default builder on September 19, 2025 and which the Nixpacks README recommends as the replacement, or a Dockerfile that pins the image. For the memory side of a Next.js server on Railway, see how I cut my Next.js server's memory on Railway.

Change the base image in your Dockerfile

With Docker, the change goes in the FROM line. The official Node images on Docker Hub come with tags of different precision. This is what each carried on November 2, according to the Docker Hub API:

TagNodeWhen it changes
node:24.22.2-bookworm-slim24.22.2Never changes Node; the image can still be rebuilt with newer Debian packages
node:24-bookworm-slim, node:24-alpine24.22.2With every release of the 24 line, when you rebuild with --pull
node:lts-slim26.13.0With every release, and across majors when the newest LTS changes
node:20-bookworm-slim20.20.2Not anymore: last updated on April 22, 2026

-slim ships only what's needed to run node; -alpine is smaller but uses musl instead of glibc; bookworm and trixie are Debian releases. Keep the variant you already use. I recommend the exact version tag: the Dockerfile states which Node runs, and every change lands in a diff. Docker's build best practices point out that tags are mutable. Pinning the digest (on November 2, node:24.22.2-bookworm-slim@sha256:c86ecead9e55a5210ac1727de38a4ca840bf03dcaf34dc9749addbf383b1920c) always gives you the same image, but the same guide warns that you opt out of automated security fixes.

A two-stage Dockerfile for Next.js, with the version in one place:

ARG NODE_VERSION=24.22.2

FROM node:${NODE_VERSION}-bookworm-slim AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM node:${NODE_VERSION}-bookworm-slim
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build --chown=node:node /app ./
USER node
CMD ["node", "node_modules/next/dist/bin/next", "start"]
  1. ARG NODE_VERSION goes before the first FROM: per the Dockerfile reference, FROM lines can use it. You change the version on one line, or try another with --build-arg NODE_VERSION=….
  2. The build stage installs from the lockfile with npm ci and builds with npm run build.
  3. The second stage starts from the same image and brings the build over with COPY --from=build: a multi-stage build.
  4. ENV NODE_ENV=production sets the environment; --chown=node:node and USER node run the app as the image's unprivileged user, not as root.
  5. CMD starts next start with node, the usual way to start a Next.js app.

Add a .dockerignore with node_modules and .next, so COPY . . doesn't overwrite what npm ci installed. I didn't build this Dockerfile: the Docker engine doesn't start on my machine. Test it on your project before production.

Rebuild, redeploy and check with node -v

Changing the tag isn't enough if the old image is still cached:

docker build --pull -t my-app .
docker build --pull --no-cache -t my-app .
docker run --rm my-app node -v
  1. --pull always attempts to pull all referenced images (docker build reference): it checks for a newer base image even when one is cached.
  2. --no-cache rebuilds every layer but doesn't pull a fresh base image. Combine it with --pull when you want both.
  3. docker run --rm my-app node -v prints your image's Node and removes the container. That's the number that counts, not your laptop's.

Then deploy the new image. If your platform redeploys the previous build, it brings back the previous Node too.

update the Node version in Docker, step by stepimageFROM node:24.22.2-bookworm-slimor the Node version on your platform (engines, variable, .nvmrc)builddocker build --pull -t my-app .--pull checks for a newer base image even when one is cacheddeploydeploy the new imageredeploying the old build brings back the old Nodeverifydocker run --rm my-app node -vand in production, the startup log with process.versionthe number that counts is production'scheck-node.mjs compares it with the minimum patched version of its line

Scroll the figure sideways to see all of it

So you don't compare versions by eye, check-node.mjs checks a version against the minimum patched release of its line. With no arguments, it checks the Node running it:

// Lowest versions with the fixes from the Node.js security release of October 21, 2026.
const PATCHED = { 22: "22.23.4", 24: "24.22.1", 26: "26.12.1" };

const version = (process.argv[2] ?? process.version).trim().replace(/^v/, "");
const [major, minor, patch] = version.split(".").map((n) => parseInt(n, 10));
const min = PATCHED[major];

if (!min) {
  console.error(`Node ${version}: ${major}.x is not one of the lines patched on October 21, 2026 (22, 24, 26).`);
  process.exit(1);
}

const [, minMinor, minPatch] = min.split(".").map(Number);
if (minor < minMinor || (minor === minMinor && patch < minPatch)) {
  console.error(`Node ${version} is older than ${min}: update the runtime, not just your dependencies.`);
  process.exit(1);
}

console.log(`Node ${version} has the October 21, 2026 fixes (${min} or later).`);
  1. PATCHED holds each line's minimum, as the advisory gives it. At the next security release, you update that line.
  2. It takes the argument or process.version, strips the leading v and splits it into major, minor and patch.
  3. If the line has no fix (20.x or an odd line), or the version is older than the minimum, it says so and exits with code 1.
  4. Otherwise it confirms and exits with 0, so it works as a CI step that fails.

I ran it with Node 22.22.3 on Windows 11:

$ node check-node.mjs
Node 22.22.3 is older than 22.23.4: update the runtime, not just your dependencies.
$ node check-node.mjs 24.10.0
Node 24.10.0 is older than 24.22.1: update the runtime, not just your dependencies.
$ node check-node.mjs 26.13.0
Node 26.13.0 has the October 21, 2026 fixes (26.12.1 or later).
$ node check-node.mjs 20.20.2
Node 20.20.2: 20.x is not one of the lines patched on October 21, 2026 (22, 24, 26).
  1. My local Node, 22.22.3, lacks the fixes. So does 24.10.0, the one Nixpacks installs for 24 according to nixpkgs.
  2. 26.13.0 has them, since it's 26.12.1 plus LTS metadata. 20.20.2 isn't on any patched line.

With the official Node 24.22.2 Windows binary, SHA-256 checked, it exits with code 0 when run with no arguments.

Check the version in production

In production you rarely have a shell. The simplest fix is to have the app state its version at startup:

import { createServer } from "node:http";

console.log(`[startup] Node ${process.version} · ${process.platform}-${process.arch} · OpenSSL ${process.versions.openssl}`);

createServer((req, res) => {
  if (req.url !== "/healthz") return res.writeHead(404).end();
  res.writeHead(200, { "content-type": "application/json", "cache-control": "no-store" });
  res.end(JSON.stringify({ status: "ok", node: process.version }));
}).listen(Number(process.env.PORT) || 3000);
  1. The [startup] line shows up once in the logs, with Node, the OS, the architecture and the OpenSSL bundled in that binary.
  2. /healthz returns the version as uncached JSON; any other path gets a 404.
  3. The port comes from PORT, the way Railway and other platforms pass it, or defaults to 3000.

With PORT=3123 node server.mjs and, in another terminal, curl -s http://localhost:3123/healthz:

[startup] Node v22.22.3 · win32-x64 · OpenSSL 3.5.6
{"status":"ok","node":"v22.22.3"}

With 24.22.2, the line reads Node v24.22.2 · win32-x64 · OpenSSL 3.5.9: the newer OpenSSL comes with the newer Node. Don't leave the endpoint open, because it tells anyone whether you're unpatched; the log is enough. In Next.js, that line belongs in the register() function of instrumentation.ts, which the instrumentation docs say runs once when each server starts, inside if (process.env.NEXT_RUNTIME === "nodejs"). I didn't run that variant.

On other platforms

Without a Dockerfile, your platform picks the version. Here's what each one's docs say:

PlatformWhere you set itExact version?Note
Railway with RailpackRAILPACK_NODE_VERSION, devEngines.runtime, engines.node, .nvmrc, .node-version, mise; otherwise ltsThe docs only show a major (22)Check the version in the log
Railway with NixpacksNIXPACKS_NODE_VERSION, engines.node or .nvmrcNo: major onlynixpkgs pins the patch
Railway with a DockerfileA Dockerfile at the root, or RAILWAY_DOCKERFILE_PATHYesThe log says Using detected Dockerfile!
RenderNODE_VERSION, .node-version, .nvmrc, engines, in that orderYes, or an alias like lts24.22.1 by default for services created since October 21
Fly.ioARG NODE_VERSION in the Dockerfile fly launch generatesYesChange the ARG and deploy
VercelSettings or engines.nodeNo: major onlyVercel rolls out patches itself
Herokuengines.nodeYes, but it recommends 24.xAdvises against open ranges like >= 24.x

One Fly detail: according to the dockerfile-node source, the generator writes the Node version of the machine you ran it on into ARG NODE_VERSION. If you generated it with an old Node, that's where it stayed.

If you're still on Node 20

Node 20 reached end-of-life on April 30, 2026; its last release is 20.20.2, from March 24. The October advisory not mentioning it doesn't mean it's safe: the same post says end-of-life versions are always affected when a security release occurs, and the Node.js End-of-Life page says they no longer receive updates, security patches included. On Docker Hub, node:20-bookworm-slim hasn't changed since April 22. It's the same problem as Next.js 14, which got no patch for October's RCE flaws. The plan:

  1. Pick a target: 22.x is supported until April 30, 2027, about six months; 24.x until April 2028; 26.x, LTS since October 28, until April 2029. The Node.js previous releases page says production apps should only use Active LTS or Maintenance LTS releases.
  2. Test on a branch: a clean install, the build, your tests and your store's critical flows.
  3. Change the base image or your platform's version, rebuild, deploy and confirm in the startup log.
  4. If you can't migrate yet, the EOL page lists commercial support from HeroDevs, NodeSource and TuxCare, as a temporary solution.

Common mistakes

  • Assuming the runtime moved. Neither npm install, npm update nor the Next.js security release changes Node.
  • Rebuilding without --pull. With a floating tag in the cache, the build keeps the old image.
  • Redeploying the previous build. It brings back the previous image and its Node. You need a new build.
  • Checking node -v on your laptop. What counts is the container in production.
  • Trusting an open range. With Nixpacks, >=18.18.0 ends up as Node 24 with a patch pinned by nixpkgs. Render and Heroku both advise against ranges with no upper bound.
  • Waiting for a Node 20 patch. It's end-of-life: none is coming.

Frequently asked questions

Does the Next.js security release also update Node?

No. It changes the next package in node_modules. Node comes from your base image or your platform. They're two separate updates: Node shipped its fixes on October 21, and Next.js on November 3.

Is setting the version in package.json engines enough?

It depends on where you deploy. npm only warns. Render, Heroku, Vercel and Railpack read it to pick a version, each with its own rules; Nixpacks only takes the major; and in a Dockerfile it does nothing, because the FROM line decides.

Should I use node:24 or an exact version tag?

With node:24 you get the line's patches every time you rebuild with --pull, but you don't know the exact version without checking. With the exact tag, the Dockerfile says it and every change goes through a diff, though you have to bump it at each security release. I prefer the exact tag, plus a reminder for the next patch.

How do I find the Node version in production without a shell?

Have the app print process.version at startup and look for it in your logs. Vercel suggests node -v in the build command and logging process.version inside the function. The build log can fall short: with Nixpacks it says something like nodejs_24, not the patch version.

Checklist

  • You know which Node runs in production, from the startup log or node -v in the container.
  • It's 22.23.4, 24.22.1, 26.12.1 or a later release of the same line.
  • The version lives in one place: the ARG or the FROM tag, or your platform's setting.
  • You rebuilt with docker build --pull and deployed the new build.
  • The startup log shows the new version.
  • If you use Nixpacks on Railway, you have a plan for Railpack or a Dockerfile.
  • If you're on Node 20, you have a date to move to 22, 24 or 26.

Checking Node is part of the same job as applying the November 3 Next.js security release: one fixes your framework, the other the program that runs it. If your project is still on an unsupported version, start with what to do if you're still on Next.js 14. And if you deploy to Railway, check memory too: how I reduced Next.js memory usage on Railway.

Saw this on Instagram? Comment NODE on the Reel and I'll send you the guide.

Written by

Luis Morales

Luis Morales

Frontend and Shopify developer, EcomLabs

@luismoralesdev on Instagram

Published November 3, 2026

← Blog