Skip to main content
You can deploy a Dockerfile or registry image directly with beam deploy.

Deploy a Dockerfile

Create a directory with this Dockerfile:
Dockerfile
From that directory, deploy and read the logs:
Open the URL printed by the command. You can omit --dockerfile when the file is named Dockerfile in your current directory.
Services are public by default. Use Service(authorized=True) to require a Beam token, or add authentication in your app.

Ports and Commands

Bind your server to 0.0.0.0 or ::. Repeat --port to expose multiple ports. Without it, Beam uses the Dockerfile’s EXPOSE ports or defaults to 8000. The first port sets PORT unless you override it. The image’s ENTRYPOINT and CMD run by default. To override them:
--command passes literal arguments. For shell syntax, use --command 'sh -c "your command"'.

Background Workers

Use --no-ports for a background worker:
Workers have no public URL. Set --replicas 1 to keep one running.

Configuration and Storage

Create the database and secret first. See references and durable disks for details. Writable disks support one container at a time. Use .beamignore to exclude local files from upload.

Scaling and Idle Time

Services default to 0–1 replicas and shut down after 600 idle seconds. To change this:
These examples use the current directory’s Dockerfile. Warm containers are billed while running.

Python Service API

You can also deploy from Python:
app.py
Use Service.from_registry("nginx:alpine", port=80) for a registry image. A Python command string runs through a shell; a list passes literal arguments.