DockHostingDocs
Stacks

Docker

Deploy anything with a Dockerfile, and the rules your image must follow.

Your Dockerfile wins

If your app's folder has a Dockerfile, we build with it, whatever else is in the repository. You control the base image, the system packages and how the app starts.

Dockerfile
FROM node:22-slim
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]

The port

We route to the port your Dockerfile EXPOSEs, unless you set one in Settings or a PORT variable. Your app must listen on it on 0.0.0.0. Reading PORT is the safest way:

ENV PORT=3000
CMD ["sh", "-c", "node server.js --port ${PORT}"]

Start command

A start command set in the project's Settings replaces your image's entrypoint and command, like Compose's command. Leave it empty to use your Dockerfile's CMD.

Rules

No database servers in your image

Don't install MySQL, PostgreSQL, MongoDB or Redis inside your Dockerfile: the container's files are reset on every deploy, so the data would be lost. We refuse those images. Create a managed database and link it.

  • No remote desktops (VNC, Openbox and similar).
  • No privileged options: start commands can't carry Docker flags like --privileged, --device or --cap-add.
  • Files written in the container are lost on redeploy; use persistent storage (paid plans) for uploads.

Keep builds fast

Add a .dockerignore so your build doesn't copy node_modules, .git and local files:

.dockerignore
node_modules
.git
.env
dist

On this page