---
title: Setting up Hosty CLI
slug: hosty/setting-up-hosty-cli
createdAt: 2026-11-08T11:27:49.710Z
---

Hosty CLI is the command line tool you use to work with the environments and backups of your project. It comes as the Docker image [`systemseed/hosty`](https://hub.docker.com/r/systemseed/hosty) with everything it needs inside, so all you install is Docker.

Before you start, finish [Setting up a new user](https://wiki.systemseed.com/hosty/setting-up-a-new-user): you need your access keys in `~/.aws` and the VPN.

## What you need

- **Docker** with **Docker Compose**. [Docker Desktop](https://docs.docker.com/get-docker/) has both.
- The project in Git, with its Hosty configuration in `.hosty/hosty.yaml` (see [Project configuration](https://wiki.systemseed.com/hosty/project-configuration)).

## 1. Pin the version of Hosty CLI

Add the version of Hosty CLI to `.env` in the root of the project. Docker Compose reads this file on its own:

```bash
HOSTY_TAG=1.5.2
```

Use the latest release from the [tags on Docker Hub](https://hub.docker.com/r/systemseed/hosty/tags) (`vX.Y.Z`). Pin a release rather than `latest`: everyone on the project and CI then run the same version, and you update it on purpose.

:::hint{type="warning"}
Hosty CLI checks for new releases on every command. A new patch release (i.e. 1.5.3 for 1.5.2) only prints a message. A new minor or major release (i.e. 1.6.0) stops all commands of older versions until you update `HOSTY_TAG`. In an emergency, i.e. to fix production before you can update, skip the check for one command:

```bash
docker compose run --rm -e HOSTY_SKIP_VERSION_CHECK=1 hosty_cli hosty <command>
```
:::

## 2. Add Hosty CLI to `compose.yml`

Add the service to `compose.yml` in the root of the project, next to `.git`:

```yaml
services:
  hosty_cli:
    image: systemseed/hosty:v${HOSTY_TAG}
    volumes:
      # The root of the project, where .git and .hosty are. Hosty CLI reads
      # the configuration and builds images from here.
      - ./:/src/project
      # Your access keys (profile "hosty.user") and the MFA session.
      - ~/.aws:/src/.aws
      # The Docker of your computer, to build images.
      - /var/run/docker.sock:/var/run/docker.sock
```

If `compose.yml` is in a subfolder, i.e. `.docker/`, map the root of the project with `../:/src/project` instead. If your access keys are in another folder than `~/.aws`, map that folder to `/src/.aws`.

## 3. Add a helper script

Typing `docker compose run --rm hosty_cli hosty` every time is tedious, so add a small script to the root of the project:

```bash
cat > hosty.sh <<'EOF'
#!/usr/bin/env bash
# Runs Hosty CLI in its container, i.e. "./hosty.sh ls".
cd "$(dirname "$0")" && exec docker compose run --rm hosty_cli hosty "$@"
EOF
chmod +x hosty.sh
```

The examples in these docs use `hosty <command>`. With the script, that is `./hosty.sh <command>`.

## 4. Check that it works

1. List the commands of Hosty CLI:

   ```bash
   ./hosty.sh list
   ```
2. Start a session with two-factor authentication. Hosty CLI asks for a code from your authenticator app:

   ```bash
   ./hosty.sh auth
   ```

   The session lasts 12 hours. Commands that need it, such as downloading backups, ask for a code again when it has expired.
3. Connect to the VPN and list the environments of the project:

   ```bash
   ./hosty.sh ls
   ```

To learn more about a command and its options, add `--help`, i.e. `./hosty.sh logs --help`.

## Next steps

- [Using Hosty CLI](https://wiki.systemseed.com/hosty/using-hosty-cli)
- [Working with environments](https://wiki.systemseed.com/hosty/working-with-environments)
