# Quickstart

> Deploy a container to a public HTTPS hostname in five commands

URL: https://pier.run/docs/quickstart

You need the `pier` CLI ([install](/docs/install)), a Pier account with a subscribed
workspace, and a container image that listens on an HTTP port. This page uses a public
image; to build from source instead, declare `build_context: .` on the app in place of
`image:` and `pier deploy` builds it.

### Log in

```bash
pier login
```

Opens the browser for a one-time code and stores a session. `pier whoami` shows the
workspace the session is in.

### Create the project

```bash
mkdir hello && cd hello
pier config init --name hello
```

Creates project `hello` in your workspace and writes `pier.yaml` in the current
directory. The file is what ties this directory to the project: every later command run
here resolves the project from it.

### Declare an app

```yaml title="pier.yaml"
version: 1
project: hello
environments:
  prod:
    apps:
      - name: web
        targets:
          - name: primary
            image: traefik/whoami:v1.10.1
            port: 80
            plan: app-s
```

`environments.prod` is the environment, `web` is the app and `primary` is its target: the
instance that runs and has a URL. A single-target app is addressed by the app name alone.
See [Concepts](/docs/concepts).

### Apply, then deploy

```bash
pier apply
pier deploy
```

`apply` converges the platform to `pier.yaml`: it creates `web` and never rolls a
workload. `deploy` builds and rolls what changed. `deploy` implies `apply`, so a script
needs only the second command. Both print a plan and ask for confirmation; `-y` skips it.

### Reach it

```bash
pier info web
```

The output includes the target's hostname, `https://<id>.app.pier.run`:

```bash
curl -sS https://<id>.app.pier.run/
```

Hostnames are keyed by a random id, not the app name, so renaming `web` later does not
change its URL. `pier add domain` attaches a custom domain.

## Next

* `pier logs web`, `pier events`, `pier monitor web`: the three read verbs
* `pier deploys` lists what was deployed; `pier rollback web` returns to a previous deploy
* [Concepts](/docs/concepts): read before adding a second environment or a second target
* [CLI reference](/docs/cli/reference): every command
