Prerequisites
- You’ve logged in to the Porter CLI after running porter auth login
- You’re connected to the correct project by running porter config set-project
- You’re connected to the correct cluster by running porter config set-cluster
porter apply
The porter apply command creates or updates applications by either applying a porter.yaml configuration file or rebuilding existing applications with their current configuration.
Usage Patterns
Configuration Precedence
Configuration values are resolved in the following order (highest priority first):- Command-line flags
- Environment variables
- Values in porter.yaml
PORTER_APP_NAMEorPORTER_STACK_NAME- Application name (replaces--appflag)PORTER_PROJECT- Project IDPORTER_CLUSTER- Cluster IDPORTER_NAMESPACE- Kubernetes namespacePORTER_TAG- Image tag (defaults to git commit SHA)
Common Flags
Build Control:--build-method [docker|pack]- Build method--build-context PATH- Build context directory--dockerfile PATH- Dockerfile path (for docker builds)--builder NAME- Builder for pack builds--attach-buildpacks LIST- Buildpacks for pack builds--no-build- Skip building a new image--tag TAG- Override image tag
--variables KEY=VALUE,...- Set environment variables--secrets KEY=VALUE,...- Set secret environment variables--attach-env-groups LIST- Attach environment groups--helm-overrides-file PATH- Helm value overrides file
--target NAME- Deployment target--preview- Deploy as preview environment--wait- Wait for deployment completion--exact- Apply exact configuration (don’t merge with existing)--predeploy- Run predeploy job
--validate- Validate porter.yaml without deploying--dry-run- Server-side validation without building/deploying

