Docker
Deploy a project with a Dockerfile: the image is built in the box and runs as one container.
A project with a Dockerfile deploys as the container it describes:
cd my-service
kvbox deploy
# ✓ my-service is live at https://my-service.kvbox.appWhat happens
- The source is shipped into the box, without
node_modulesand.git. Docker applies your.dockerignorewhen it builds. - The box builds the image with
docker buildwhile the old container keeps serving. A failed build changes nothing. - The old container is replaced by one from the new image, named
kvbox-app, with Docker's--restart unless-stopped; Docker is set to start at boot, so the container is back after a stop and start. Old images are pruned. - The deploy waits up to 30 s for the app to answer inside the container, on the port the
DockerfileEXPOSEs; if it never does, or the container stops, it fails with the container's last log lines.
Docker comes with the box's image, so nothing is installed. A first build pulls the base image and takes a minute or two; later builds reuse the layer cache in the box.
Ports
The address points at the box port, 3000 by default or --port (saved to kvbox.json as port). It is mapped to the port your Dockerfile EXPOSEs, so the container listens where it always did. Without an EXPOSE, the container gets PORT set to the box port and is expected to listen on it.
FROM node:22-alpine
WORKDIR /app
COPY . .
RUN npm ci --omit=dev
EXPOSE 8080
CMD ["node", "server.js"]When a project fits two templates
A Next.js app or a Node server with a Dockerfile deploys with Docker: the file was written to be deployed. On a terminal the template question shows the other match next to it; with -y the deploy says which template it took and how to pick the other, kvbox deploy --template nextjs. The choice is saved in kvbox.json, so it is made once.
Logs and shell
kvbox exec my-service -- docker logs -f kvbox-app
kvbox exec --tty my-service -- docker exec -it kvbox-app shNot yet
One container per box: a compose.yml with a database next to the app is not deployed by kvbox deploy. Your variables do not reach the container yet either.
Defaults
The box is s (2 vCPU, 4 GB of RAM): a docker build of a Node or Python app runs out of memory on less. It hibernates after an hour without traffic and wakes on the next request.