# endia command line

> Every endia command, grouped by what it works on, with its Docker counterpart.

`endia` follows Docker's commands and options wherever Docker has one. Every command takes `--help`, which lists its options. Long-running work, such as a build or `compose up`, runs on the service as an operation. The command follows the operation's log, and Ctrl+C cancels the operation.

## Images

| Command | Docker | What it does |
|---|---|---|
| `endia base prepare <iso>` | none | Installs Windows from an installation disc and makes a [root image](/docs/by-hand/building-images/#the-root-image), the Windows disk every other image is built on. |
| `endia import <vhdx> <name>` | `docker import` | Imports a Windows disk you prepared yourself as a root image. |
| `endia build` | `docker build` | Builds an image from an [Endiafile](/docs/reference/endiafile/), a recipe in Dockerfile syntax. |
| `endia images` | `docker images` | Lists images. |
| `endia image inspect` | `docker image inspect` | Prints images as JSON. |
| `endia tag` | `docker tag` | Points a tag at an image. |
| `endia rmi` | `docker rmi` | Removes tags and images. |
| `endia builder prune` | `docker builder prune` | Deletes the build cache that nothing uses. |

## Fleets

| Command | Docker | What it does |
|---|---|---|
| `endia compose up` | `docker compose up` | Creates or updates a fleet from a Compose file. |
| `endia compose down` | `docker compose down` | Removes a fleet's machines and networks; `-v` also removes its volumes. |
| `endia compose stop`, `start`, `restart` | the same under `docker compose` | Stops, starts or restarts a fleet's machines, keeping their disks. |
| `endia compose ps` | `docker compose ps` | Lists a fleet's machines. |
| `endia compose ls` | `docker compose ls` | Lists fleets. |
| `endia compose logs` | `docker compose logs` | Shows what the machines' main processes printed. |
| `endia compose config` | `docker compose config` | Prints the Compose file as East India reads it. |
| `endia compose exec`, `cp` | the same under `docker compose` | Runs a program in, or copies files to or from, one of a fleet's machines. |

## Machines

| Command | Docker | What it does |
|---|---|---|
| `endia ps` | `docker ps` | Lists machines. |
| `endia inspect` | `docker inspect` | Prints machines as JSON, with their addresses and ports. |
| `endia start`, `stop`, `restart` | the same under `docker` | Starts, stops or restarts a machine. |
| `endia pause`, `unpause` | the same under `docker` | Pauses or resumes a machine. |
| `endia rm` | `docker rm` | Removes a machine and its disk. |
| `endia logs` | `docker logs` | Shows what a machine's main process printed. |
| `endia stats` | `docker stats` | Shows machines' processor, memory, disk and network use; `--host` shows the PC's. |

## Programs and files in a machine

| Command | Docker | What it does |
|---|---|---|
| `endia exec` | `docker exec` | Runs a program in a machine; `-d` returns its process ID at once. |
| `endia cp` | `docker cp` | Copies files into or out of a machine. |
| `endia process ls` | `docker top` | Lists a machine's processes. |
| `endia process inspect` | none | Shows one process in full, with its windows. |
| `endia process wait` | `docker wait` | Waits until a process ends and prints its exit code. |
| `endia process stop` | `docker stop` | Asks a process to close, then ends it. |
| `endia process logs` | none | Prints what a process started by `exec -d` wrote. |

## The desktop

These commands have no Docker counterpart. [Controlling the desktop](/docs/by-hand/desktop/) describes each.

| Command | What it does |
|---|---|
| `endia desktop launch` | Starts a program on the machine's desktop. |
| `endia desktop screenshot` | Takes a screenshot of the desktop or of one process's window. |
| `endia desktop inspect` | Prints a window's elements as UI Automation sees them. |
| `endia desktop wait` | Waits until an element exists, or with `--gone` until it does not. |
| `endia desktop invoke` | Presses an element through UI Automation. |
| `endia desktop click` | Clicks an element with the mouse. |
| `endia desktop set-value` | Sets a text box or similar element. |
| `endia desktop keys` | Presses key chords, or types text. |
| `endia desktop pointer` | Moves the mouse to a point and clicks or scrolls there. |
| `endia desktop windows` | Lists the visible windows. |
| `endia desktop tray ls`, `tray click` | Lists or clicks the icons in the notification area. |
| `endia desktop uac` | Answers a Windows elevation prompt. |

## Volumes, purposes and operations

| Command | Docker | What it does |
|---|---|---|
| `endia volume ls`, `inspect`, `rm` | the same under `docker volume` | Lists, shows or removes volumes. |
| `endia update` | none; the name is Docker's `docker update`, but none of its options | Sets or clears what a fleet or machine is being used for (`--purpose`, `--purpose-file`), and records how far its work has got (`--stage`, `--workload`, `--progress`). A value of -1 removes a number, and `""` removes text. [Purpose and progress](/docs/testing/purpose-and-progress/) shows how to use it. |
| `endia purpose show` | none | Shows what a fleet or machine is being used for, who set it, and its stage and progress; `--history` adds every change. |
| `endia operation ls`, `inspect`, `logs`, `cancel` | none | Lists, shows, follows or cancels long-running work. |

## The service and connections

| Command | Docker | What it does |
|---|---|---|
| `endia version` | `docker version` | Prints the versions of the command line and the service. |
| `endia info` | `docker info` | Prints the PC's description, every setting in effect and what needs attention. |
| `endia system df` | `docker system df` | Shows the disk space each kind of object uses. |
| `endia system prune` | `docker system prune` | Deletes stopped machines, unused images and objects that belong to nothing. |
| `endia system image-folder` | none | Moves the image folder; only on the PC. |
| `endia context create`, `export`, `import`, `ls`, `use`, `show`, `inspect`, `rm` | the same under `docker context` | Manages contexts: the address and certificate `endia` connects with. `export` also issues a client certificate. |
| `endia cert ls`, `rm` | none | Lists client certificates, or ends one at once; only on the PC. |

## Exit codes and messages

| Code | Meaning |
|---|---|
| 0 | Success. |
| 1 | The request was refused, the operation failed, was cancelled or was interrupted, the service could not be reached, or it refused the client certificate. |
| 125 | A usage error: an unknown command or option, a missing or malformed argument, or options that exclude each other. Nothing was sent. |
| 126 | `exec`: the program was found but could not start. |
| 127 | `exec`: the program was not found. |
| 130 | Ctrl+C ended the command. |
| any other | `exec`: the program's own exit code. |

The command line writes results to standard output and everything else to standard error:

- a refusal: `Error response from EastIndia: <message> (<CODE>)`;
- an unreachable service: `Cannot connect to the EastIndia service at <address>. Is the service running?`;
- a usage error: `endia: <reason>.` and `See 'endia <command> --help'.`, as Docker prints them.

`--format json` gives any listing as JSON for a program to read. [Limits and errors](/docs/reference/limits-and-errors/) lists every error code.

## Command-line settings

The command line's `config.json`, in `~/.eastindia`, holds the current context and two optional retry settings:

| Key | Default | Meaning |
|---|---|---|
| `requestRetries` | `2` | Times a changing request is sent again after its connection failed before any reply; 0 to 10. |
| `requestRetryDelayMilliseconds` | `1000` | Milliseconds between those attempts; at least 100. |

An unknown key or a value out of range makes every command fail with exit code 125, naming the key. `EASTINDIA_HOST` with `EASTINDIA_CERT_PATH`, and `EASTINDIA_CONTEXT`, override the current context, as `DOCKER_HOST`, `DOCKER_CERT_PATH` and `DOCKER_CONTEXT` do.
