Skip to main content
This guide covers the essential commands and configuration options for the Porter CLI.

Quick Start

1

Login to Porter

Authenticate with your Porter account:
porter auth login
This opens your browser to complete authentication and automatically configures your default project and cluster.
2

Verify Configuration

Check your current CLI configuration:
porter config
If necessary, switch your project and/or cluster
3

Deploy Your App

Deploy using a porter.yaml file:
porter apply -f porter.yaml
porter.yaml reference porter apply reference

Project and Cluster Configuration

After logging in, you may need to switch between projects or clusters.

List Available Projects

porter projects list

Set Active Project

porter config set-project [PROJECT_ID]

List Available Clusters

porter clusters list

Set Active Cluster

porter config set-cluster [CLUSTER_ID]

View Current Configuration

porter config

Global Flags

These flags can be used with any Porter command:
FlagDescription
--project <id>Override the project ID for this command
--cluster <id>Override the cluster ID for this command
--token <string>Use a specific authentication token
-h, --helpDisplay help for the command
porter app logs my-app --project 12345

Environment Variables

Environment variables provide an alternative way to configure the CLI, which is especially useful in CI/CD pipelines.
VariableDescriptionEquivalent Flag
PORTER_PROJECTProject ID to use--project
PORTER_CLUSTERCluster ID to use--cluster
PORTER_TOKENAuthentication token--token
PORTER_HOSTCustom Porter API host--host
PORTER_APP_NAMEDefault app name for commands--app
Environment variables take precedence over values in your config file, but flags take precedence over environment variables.

Example: CI/CD Configuration

export PORTER_TOKEN="your-deploy-token"
export PORTER_PROJECT="12345"
export PORTER_CLUSTER="67890"

porter apply -f porter.yaml

Common Workflows

Local Development

# Login and configure
porter auth login

# View your app's logs
porter app logs my-app

# Run a command in an ephemeral copy of your app
porter app run my-app -- bash

# View current app configuration
porter app yaml my-app

CI/CD Deployment

# Deploy with explicit configuration
PORTER_TOKEN=$DEPLOY_TOKEN \
PORTER_PROJECT=$PROJECT_ID \
PORTER_CLUSTER=$CLUSTER_ID \
porter apply -f porter.yaml

Managing Environment Variables

# Pull environment variables from an app
porter env pull -a my-app

# Pull environment variables from an environment group
porter env pull -g my-env-group

# Set environment variables on an app
porter env set -a my-app -v KEY=value

# Set secrets on an environment group
porter env set -g my-env-group -s API_KEY=secret123

Debugging

# Stream live logs
porter app logs my-app

# View historical logs
porter app logs my-app --since 1h

# Run a command in an ephemeral copy of your app
porter app run my-app -- bash

Viewing Help

You can view help instructions for any command using the -h or --help flag:
# General help
porter -h

# Help for a specific command
porter app -h

# Help for a subcommand
porter app run -h

Next Steps