hud deploy command builds and deploys your environment directly to the HUD platform from a Dockerfile, without requiring a GitHub repository.
This is the recommended way to deploy environments. Unlike
hud push which pushes to Docker Hub, hud deploy builds remotely on HUD’s infrastructure and stores the image in HUD’s registry.Usage
Arguments
Environment directory containing a Dockerfile.hud or Dockerfile
Options
Environment display name. Defaults to
[tool.hud].name in pyproject.toml, or directory name. Short: -nEnvironment variable in KEY=VALUE format. Can be repeated. Short:
-ePath to .env file (default: .env in directory if exists)
Docker build argument in KEY=VALUE format. Can be repeated. Used for Dockerfile
ARG directives.Docker build secret. Format:
id=SECRET_ID,env=ENV_VAR or id=SECRET_ID,src=./path. Encrypted at rest.Disable Docker build cache for a clean rebuild
Skip confirmation prompts. Short:
-yShow detailed output including files added to tarball. Short:
-vPrerequisites
What It Does
Package Context
Creates a tarball of your build context, respecting
.dockerignore and excluding sensitive files (.env, .git, etc.)Environment Variables, Build Arguments & Secrets
Three flags for different purposes:| Flag | When Used | Stored In | Use For |
|---|---|---|---|
--env | Runtime | Platform (encrypted) | API keys, feature flags, runtime config |
--build-arg | Build time | Image layers | Repo URLs, build modes, versions |
--secret | Build time | Not stored in image | Private repo tokens, credentials during build |
- --env
- --build-arg
- --secret
Runtime environment variables — injected when the container runs.Values are encrypted on the platform and can be changed without rebuilding.
Environment Name Resolution
The environment name is determined in this order:--nameflag (explicit)[tool.hud].namein pyproject.toml[tool.hud].imagein pyproject.toml (name part, without tag)- Directory name
Examples
Basic Deploy
With Environment Variables
With Build Arguments
With Build Secrets
Combined Usage
Custom Name
Non-Interactive (CI/CD)
Rebuilding
When you runhud deploy again in a linked directory:
- Reads
.hud/deploy.jsonto find the existing environment - Fetches stored environment variables from the platform
- Builds a new version of the same environment
- Version number auto-increments (0.1.0 → 0.1.1 → 0.1.2)
Project Linking
After deployment,.hud/deploy.json is created:
.dockerignore
Create a.dockerignore file to exclude files from the build context:
Even without
.dockerignore, HUD automatically excludes common sensitive files like .env, .git, and virtual environments.Comparison with hud build + hud push
| Feature | hud deploy | hud build + hud push |
|---|---|---|
| Build location | Remote (HUD CodeBuild) | Local (Docker) |
| Registry | HUD ECR | Docker Hub/GHCR |
| Build args | Yes (--build-arg) | Yes (via hud build) |
| Build secrets | Yes (--secret) | Yes (via hud build) |
| Env var storage | HUD platform | Not stored |
| Recommended for | Platform deployments | Docker Hub sharing |
hud push only pushes an already-built image. Use hud build --build-arg and hud build --secret for local builds with build arguments and secrets, then hud push to share.See Also
hud link- Link directory to existing environmenthud build- Build locallyhud push- Push to Docker Hub- Platform Environments - Managing environments on hud.ai