> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dokrypt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# dokrypt exec

> Execute a command inside a running service container.

## Usage

```bash theme={null}
dokrypt exec <service> <command> [args...] [flags]
```

## Arguments

| Argument  | Required | Description                                 |
| --------- | -------- | ------------------------------------------- |
| `service` | Yes      | Service name (as defined in `dokrypt.yaml`) |
| `command` | Yes      | Command to execute                          |
| `args`    | No       | Additional command arguments                |

## Flags

| Flag                | Type   | Default | Description           |
| ------------------- | ------ | ------- | --------------------- |
| `-i, --interactive` | `bool` | `false` | Keep stdin open       |
| `-t, --tty`         | `bool` | `false` | Allocate a pseudo-TTY |

## Description

Executes a command inside the container of a running service. The command runs with the container's default user and environment. Stdout and stderr are streamed back to your terminal.

## Examples

### Run a shell in the ethereum container

```bash theme={null}
dokrypt exec ethereum sh
```

### Query the latest block with cast

```bash theme={null}
dokrypt exec ethereum cast block latest
```

### Check IPFS node identity

```bash theme={null}
dokrypt exec ipfs ipfs id
```

### List files in a container

```bash theme={null}
dokrypt exec ethereum ls -la /
```

### Interactive bash session

```bash theme={null}
dokrypt exec -it ethereum bash
```

## Errors

| Error                   | Cause                             | Solution                                    |
| ----------------------- | --------------------------------- | ------------------------------------------- |
| `Service not found`     | Service name doesn't match config | Check `dokrypt status` for service names    |
| `Container not running` | The service is stopped            | Start it with `dokrypt up --service <name>` |
