> ## Documentation Index
> Fetch the complete documentation index at: https://docs.porter.run/llms.txt
> Use this file to discover all available pages before exploring further.

# porter app

> Manage Porter applications from the CLI with commands to run, exec, logs, update config, list builds, and view environment variables

`porter app` contains commands for managing and interacting with your applications.

## Prerequisites

* You've logged in to the Porter CLI after running [porter auth login](/standard/cli/command-reference/porter-auth)
* You're connected to the correct project by running [porter config set-project](/standard/cli/command-reference/porter-config)
* You're connected to the correct cluster by running [porter config set-cluster](/standard/cli/command-reference/porter-config)

***

## `porter app run`

Runs a command inside your application's environment. By default, this spins up an ephemeral copy of your application that is deleted when the command completes.

**Usage:**

```bash theme={null}
porter app run [application] -- COMMAND [args...] [flags]
```

**Options:**

| Flag                 | Description                                                                                                                                                                              |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-e`                 | Connect to an existing replica instead of spinning up a new one (default: false). This will launch an interactive selector if there is more than one replica of your application running |
| `--job`              | Name of the job to run (runs the job as defined and returns the job run ID without waiting)                                                                                              |
| `--wait`             | Wait for the command to complete before exiting for non-interactive mode (default: false)                                                                                                |
| `--allow-concurrent` | Allow concurrent job runs when using `--job` (overrides job config if concurrency is disabled)                                                                                           |
| `--cpu`              | CPU allocation in millicores (1000 millicores = 1 vCPU)                                                                                                                                  |
| `--ram`              | RAM allocation in Mi (1024 Mi = 1 GB)                                                                                                                                                    |
| `-v`                 | Print verbose output                                                                                                                                                                     |

<Warning>
  The `--cpu` and `--ram` flags aren't applicable when used with the `-e` flag as they require spinning up an ephemeral replica of your application.
</Warning>

<CodeGroup>
  ```bash Interactive Shell theme={null}
  porter app run my-app -- bash
  ```

  ```bash Existing Container theme={null}
  porter app run my-app -e -- bash
  ```

  ```bash Trigger Job theme={null}
  porter app run my-app --job my-job
  ```

  ```bash Wait for Job theme={null}
  porter app run my-app --job my-job --wait
  ```

  ```bash Concurrent Job theme={null}
  porter app run my-app --job my-job --allow-concurrent
  ```

  ```bash Run Command theme={null}
  porter app run my-app -- python manage.py migrate
  ```

  ```bash Custom Resources theme={null}
  porter app run my-app --cpu 500 --ram 512 -- python heavy_script.py
  ```
</CodeGroup>

<Info>
  In these examples, we use `bash` and `python`, but those commands need to actually be present within the container to run. With very lightweight containers, you may find that none of these are available. If you run into trouble here, feel free to reach out to the support team.
</Info>

***

## `porter app run cleanup`

Delete any lingering ephemeral replicas that were created with `porter app run`.

**Usage:**

```bash theme={null}
porter app run cleanup
```

***

## `porter app logs`

Streams the latest logs for an application.

**Usage:**

```bash theme={null}
porter app logs [application] [flags]
```

**Options:**

| Flag         | Description                                                          |
| ------------ | -------------------------------------------------------------------- |
| `--service`  | The name of the service to get logs for                              |
| `--search`   | Search for a specific string in the logs                             |
| `--revision` | The revision number to get logs for (default: -1, no filter applied) |

**Historical Log Options:**

| Flag             | Description                                                                       |
| ---------------- | --------------------------------------------------------------------------------- |
| `--since`        | Lookback period from the current time to get historical logs (e.g., `12h`, `30m`) |
| `--from`         | Start time (UTC) for historical logs (format: `2021-01-01T00:00:00Z`)             |
| `--to`           | End time (UTC) for historical logs (format: `2021-01-01T00:00:00Z`)               |
| `--limit`        | Number of lines of historical logs to return                                      |
| `--newest-first` | Return newest historical logs first (default: true)                               |

<CodeGroup>
  ```bash Stream Live Logs theme={null}
  porter app logs my-app
  ```

  ```bash Filter by Service theme={null}
  porter app logs my-app --service web
  ```

  ```bash Search Logs theme={null}
  porter app logs my-app --search "error"
  ```

  ```bash Historical Logs theme={null}
  porter app logs my-app --since 12h
  ```

  ```bash Time Range theme={null}
  porter app logs my-app --from 2025-01-15T10:00:00Z --to 2025-01-15T12:00:00Z
  ```

  ```bash Limit Results theme={null}
  porter app logs my-app --since 24h --limit 500
  ```
</CodeGroup>

<Info>
  By default, the command streams new logs. Setting `--since` or `--from`/`--to` switches to pulling historical logs.
</Info>

***

## `porter app build`

Builds a new version of the specified app. Attempts to use any build settings previously configured for the app, which can be overridden with flags.

**Usage:**

```bash theme={null}
porter app build [application] [flags]
```

**Options:**

| Flag                  | Description                                                                  |
| --------------------- | ---------------------------------------------------------------------------- |
| `--build-context`     | Set the build context for the app                                            |
| `--dockerfile`        | Set the path to the Dockerfile when build method is `docker`                 |
| `--tag`               | Set the image tag to use for the build                                       |
| `--build-method`      | Set the build method for the app (`docker` or `pack`)                        |
| `--builder`           | Set the builder to use when build method is `pack`                           |
| `--attach-buildpacks` | Attach buildpacks to use when build method is `pack`                         |
| `--no-pull`           | Do not pull the previous image before building                               |
| `--remote`            | \[EXPERIMENTAL] Build remotely using kpack in the cluster instead of locally |
| `--verbose`           | Show verbose output during build (detailed logs, step timings)               |

<CodeGroup>
  ```bash Basic Build theme={null}
  porter app build my-app
  ```

  ```bash Custom Context theme={null}
  porter app build my-app --build-context ./frontend --dockerfile ./frontend/Dockerfile
  ```

  ```bash With Tag theme={null}
  porter app build my-app --tag v1.2.3
  ```

  ```bash With Buildpacks theme={null}
  porter app build my-app --build-method pack --builder heroku/builder:22 --attach-buildpacks heroku/nodejs
  ```
</CodeGroup>

***

## `porter app push`

Pushes the specified app to your default Porter registry. If no tag is specified, the latest commit SHA from the current branch will be used as the tag.

**Usage:**

```bash theme={null}
porter app push [application] [flags]
```

**Options:**

| Flag    | Description                           |
| ------- | ------------------------------------- |
| `--tag` | Set the image tag to use for the push |

<CodeGroup>
  ```bash Push Latest theme={null}
  porter app push my-app
  ```

  ```bash Push Specific Tag theme={null}
  porter app push my-app --tag v1.2.3
  ```
</CodeGroup>

***

## `porter app create`

Creates and deploys a new app in your project. If no flags are specified, you will be directed to a series of required prompts to configure the app.

**Usage:**

```bash theme={null}
porter app create [flags]
```

**Options:**

| Flag                  | Short | Description                                                                  |
| --------------------- | ----- | ---------------------------------------------------------------------------- |
| `--name`              | `-n`  | The name of the app                                                          |
| `--file`              | `-f`  | Path to porter.yaml                                                          |
| `--deploy-method`     | `-m`  | The deployment method for the app (`docker`, `repo`)                         |
| `--tag`               |       | Set the image tag used for the application (overrides field in yaml)         |
| `--image-repository`  |       | Set the image repository to use for the app                                  |
| `--attach-env-groups` |       | Attach environment groups to the app                                         |
| `--build-context`     |       | Set the build context for the app                                            |
| `--build-method`      |       | Set the build method for the app (`docker` or `pack`)                        |
| `--dockerfile`        |       | Set the path to the Dockerfile when build method is `docker`                 |
| `--builder`           |       | Set the builder to use when build method is `pack`                           |
| `--attach-buildpacks` |       | Attach buildpacks to use when build method is `pack`                         |
| `--remote`            |       | \[EXPERIMENTAL] Build remotely using kpack in the cluster instead of locally |
| `--verbose`           |       | Show verbose output during build                                             |

<CodeGroup>
  ```bash Interactive Creation theme={null}
  porter app create
  ```

  ```bash With Name theme={null}
  porter app create --name example-app
  ```

  ```bash From YAML theme={null}
  porter app create --name my-app -f porter.yaml
  ```
</CodeGroup>

***

## `porter app update`

Updates the specified app with the provided configuration. This command differs from `porter apply` in that it only updates the app, but does not attempt to build a new image.

**Usage:**

```bash theme={null}
porter app update [application] [flags]
```

**Options:**

| Flag                  | Short | Description                                                          |
| --------------------- | ----- | -------------------------------------------------------------------- |
| `--file`              | `-f`  | Path to porter.yaml                                                  |
| `--tag`               |       | Set the image tag used for the application (overrides field in yaml) |
| `--image-repository`  |       | Set the image repository to use for the app                          |
| `--attach-env-groups` |       | Attach environment groups to the app                                 |
| `--wait`              | `-w`  | Wait until an update has rolled out successfully, otherwise time out |

<CodeGroup>
  ```bash Update from YAML theme={null}
  porter app update my-app -f porter.yaml
  ```

  ```bash Update Image Tag theme={null}
  porter app update my-app --tag v1.2.3
  ```

  ```bash Wait for Rollout theme={null}
  porter app update my-app -f porter.yaml --wait
  ```
</CodeGroup>

<Info>
  This command differs from `porter apply` in that it only updates the app configuration without attempting to build a new image.
</Info>

***

## `porter app update-tag`

Updates the image tag for an application. This is functionally equivalent to running `porter apply` or `porter app update` with the `--tag` flag.

**Usage:**

```bash theme={null}
porter app update-tag [application] [flags]
```

**Options:**

| Flag     | Short | Description                                                           |
| -------- | ----- | --------------------------------------------------------------------- |
| `--tag`  | `-t`  | The specified tag to use (default: `latest`)                          |
| `--wait` | `-w`  | Wait and be notified when an update is successful, otherwise time out |

<CodeGroup>
  ```bash Update Tag theme={null}
  porter app update-tag my-app --tag abc123def
  ```

  ```bash Wait for Rollout theme={null}
  porter app update-tag my-app --tag v1.2.3 --wait
  ```
</CodeGroup>

***

## `porter app yaml`

Export the current Porter YAML configuration for an application. Useful for bootstrapping a `porter.yaml` file or inspecting the current configuration.

**Usage:**

```bash theme={null}
porter app yaml [application] [flags]
```

**Options:**

| Flag               | Description                                        |
| ------------------ | -------------------------------------------------- |
| `--helm-overrides` | Return only the helm overrides for the application |

<CodeGroup>
  ```bash Export YAML theme={null}
  porter app yaml my-app
  ```

  ```bash Helm Overrides Only theme={null}
  porter app yaml my-app --helm-overrides
  ```
</CodeGroup>

<Tip>
  Redirect the output to create a `porter.yaml` file: `porter app yaml my-app > porter.yaml`
</Tip>

***

## `porter app list`

Lists all applications in the project.

**Usage:**

```bash theme={null}
porter app list
```

***

## `porter app manifests`

Prints the Kubernetes manifests for an application.

**Usage:**

```bash theme={null}
porter app manifests [application]
```

```bash theme={null}
porter app manifests my-app
```

***

## `porter app rollback`

Rolls back an application to the last successful revision.

**Usage:**

```bash theme={null}
porter app rollback [application]
```

```bash theme={null}
porter app rollback my-app
```

***

## Related Commands

* [porter apply](/standard/cli/command-reference/porter-apply) - Deploy an app using configuration-as-code
* [porter env](/standard/cli/command-reference/porter-env) - Manage environment variables
