# dflow apps:deploy

> Deploy a container image and wait until it is running.

Web page: /docs/cli/path/apps-deploy/

This deploys a container image to the application you already created. By default the command waits until the new containers are up. `succeeded` means the rollout finished and the new containers stayed Ready, with no restart, for a short window. A crash fails the operation, and the message names the container.

```bash
dflow apps:deploy APP --image IMAGE [--port N] [--replicas N] [--cpu-millicores N] [--memory-mi N]
```

## Flags

`--image` is required. `--port`, `--replicas`, `--cpu-millicores`, and `--memory-mi` are optional. A sizing flag you leave off is left out of the JSON. The API then uses the value already stored in `dflow.json` for that field, when one is set.

`--wait` defaults to true. `--wait-timeout` defaults to `15m`. `--timeout` is the same default. The usual global flags still apply.

## What you see

The terminal prints `id` and `status`. On a terminal, `succeeded` is green and `pending` is yellow. Exit 0 when the status is `succeeded`. Exit 0 also for `--wait=false`, which returns as soon as the API accepts the deploy.

## Example

```bash
dflow apps:deploy api --image ghcr.io/example/api:1 --cpu-millicores 200 --memory-mi 512
```

## When it fails

A missing `--image` exits 1 before a request. `--wait-timeout` below 1s or above 30m exits 1. The API rejects a bad image, a port outside 1 to 65535, and a replica count below 1. A count above the workspace cap (3 replicas on one application, unless an operator raised it) exits 6. CPU or memory above the workspace cap, or outside the cluster LimitRange, fails the operation with a message that names the limit. A LimitRange is the cluster's minimum and maximum for CPU and memory.

Exit 1: validation. Exit 2: auth. Exit 3: the application was not found. Exit 4: conflict. Exit 5: the operation `failed` or was `cancelled`. Exit 6 when the operation error code is `precondition` or `rate_limited`. Exit 7: the wait ended first, and the operation is still running. Exit 10: the API could not be reached.
