dicer instance exec
Runs a command inside a running instance, /bin/sh if none is given.
A pseudo-TTY is allocated when this terminal is on both ends – stdin and stdout – so a shell is interactive, and output piped elsewhere is not mangled by one. -t and -T force it on or off. Flags go before the name: everything after it is the command’s.
The command runs as the workload does: as the instance’s user, its image’s USER, or root. -u names another of the guest’s users, as user, uid, user:group or uid:gid. The command gets the user’s groups, and the user’s home directory as HOME.
If the instance is still booting, exec waits up to 30 seconds for its guest agent to answer.
Usage
$ dicer instance exec [flags] NAME [COMMAND [ARG...]]
Examples
$ dicer exec web
$ dicer exec web ls -la /srv
$ dicer exec -e DEBUG=1 -w /srv web ./check.sh
$ dicer exec -u postgres db psql
$ dicer exec -T web cat /var/log/app.log > app.log
Flags
| Flag | Description |
|---|---|
-e, --env stringArray | Environment variable as KEY=VALUE, or KEY to pass this shell’s value (repeatable). |
-T, --no-tty | Do not allocate a pseudo-TTY. |
--timeout duration | Kill the command after this long, e.g. 30s (0: no limit). |
-t, --tty | Allocate a pseudo-TTY (default: when stdin and stdout are a terminal). |
-u, --user string | User to run as: user, uid, user:group or uid:gid (default: the workload’s user). |
-w, --workdir string | Working directory inside the instance. |
Global flags
| Flag | Description |
|---|---|
-D, --debug | Trace every call to the daemon on stderr (or set $DICER_DEBUG). |
-r, --remote string | Daemon to talk to: a remote’s name, or an address (unix:///PATH or HOST:PORT) (default $DICER_REMOTE, then the current remote, then local). |
--request-timeout duration | Give up on a single call to the daemon after this long, e.g. 30s (0: never; streams such as logs -f and exec are not bounded). |