Skip to content
Docs

Container Images

Container Images are available in Beta on all plans

Vercel Functions can run Open Container Initiative (OCI) compatible container images stored in Vercel Container Registry (VCR). Functions scale up and down automatically based on demand, and use Active CPU pricing. You are only billed for CPU when your code is actively running, not while waiting for I/O or sleeping.

Get started by creating a Dockerfile.vercel (or Containerfile.vercel) file placed at the root of your project. Vercel automatically detects these files and adds a rewrite rule to route all traffic to the container image:

Dockerfile.vercel
FROM node:26-alpine
 
RUN npm i -g srvx
WORKDIR /app
COPY server.ts .
 
# srvx listens on $PORT by default
CMD ["srvx", "--prod"]
server.ts
export default {
  fetch(req: Request) {
    return Response.json({ ip: req.headers.get("x-forwarded-for") })
  }
}
Dockerfile.vercel
FROM nginx:alpine
 
COPY . /usr/share/nginx/html
index.html
<h1>Hello from Vercel Functions running a custom OCI image!</h1>

Deploy your application using the Vercel CLI or by pushing to a Git repository. During the build step, the image will be built and pushed to VCR.

You can also develop and test locally using vercel dev. This requires the docker CLI and Docker daemon to be available on your machine.

You can use services to deploy multiple applications, backends or frontends, within the same Vercel project. Traffic is routed to the correct service with the rewrites configuration:

vercel.json
{
  "services": {
    "frontend": {
      "root": "frontend/",
      "entrypoint": "Dockerfile.vercel"
    },
    "backend": {
      "root": "backend/",
      "entrypoint": "Dockerfile.vercel"
    }
  },
  "rewrites": [
    { "source": "/api/(.*)", "destination": { "service": "backend" } },
    { "source": "/(.*)", "destination": { "service": "frontend" } }
  ]
}
frontend/Dockerfile.vercel
FROM nginx:alpine
...
backend/Dockerfile.vercel
FROM node:26-alpine
...

Set the entrypoint key to the path of your dockerfile, relative to the service's root, for each service that uses a custom container image. See services for more information on configuring services.

You can view runtime logs from the container's stdout and stderr streams. Because these logs are not tied to a specific request, they are broadcast to all inflight requests of the instance. Vercel Observability metrics are available like any regular Vercel Function.

Vercel Functions running container images are expected to open an HTTP server to receive traffic on. The default port is 80, and it can be overridden by setting the PORT environment variable in the project settings.

Functions not receiving any traffic for 5 minutes in production environments, and 30 seconds in preview environments, will automatically scale down.

When a function instance is scaled down, the container receives a SIGTERM signal with a 30 seconds grace period to clean up before being forcefully terminated. Learn more about the SIGTERM signal.

The same limits and Active CPU pricing model of Vercel Functions apply to custom container images.

Secure Compute and Static IPs are not yet supported with custom container images.

Last updated June 30, 2026

Was this helpful?

supported.