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

# truss image

> Build and manage Truss Docker images.

```sh theme={"system"}
truss image [OPTIONS] COMMAND [ARGS]...
```

Build and manage Docker images for your Truss.

***

## `build`

Build the Docker image for a Truss.

```sh theme={"system"}
truss image build [OPTIONS] [TARGET_DIRECTORY] [BUILD_DIR]
```

### Options

<ParamField body="--tag" type="TEXT">
  Docker image tag.
</ParamField>

<ParamField body="--use_host_network">
  Use the host network for the Docker build.
</ParamField>

### Arguments

<ParamField body="TARGET_DIRECTORY" type="TEXT">
  A Truss directory. Defaults to current directory.
</ParamField>

<ParamField body="BUILD_DIR" type="TEXT">
  Image context directory. If not provided, a temp directory is created.
</ParamField>

**Example:**

Build a Docker image for your Truss:

```sh theme={"system"}
truss image build
```

Build with a custom tag:

```sh theme={"system"}
truss image build --tag my-model:v1
```

***

## `build-context`

Create a Docker build context for a Truss without building the image.

```sh theme={"system"}
truss image build-context [OPTIONS] BUILD_DIR [TARGET_DIRECTORY]
```

### Arguments

<ParamField body="BUILD_DIR" type="TEXT" required>
  Directory where image context is created.
</ParamField>

<ParamField body="TARGET_DIRECTORY" type="TEXT">
  A Truss directory. Defaults to current directory.
</ParamField>

**Example:**

Create a build context in a specific directory:

```sh theme={"system"}
truss image build-context ./build-context
```

***

## `run`

Run the Docker image for a Truss locally.

```sh theme={"system"}
truss image run [OPTIONS] [TARGET_DIRECTORY] [BUILD_DIR]
```

### Options

<ParamField body="--tag" type="TEXT">
  Docker image tag to run.
</ParamField>

<ParamField body="--port" type="INTEGER">
  Local port to expose the model on. Default: `8080`.
</ParamField>

<ParamField body="--attach">
  Attach to the container process.
</ParamField>

<ParamField body="--use_host_network">
  Use the host network for the Docker build and run.
</ParamField>

### Arguments

<ParamField body="TARGET_DIRECTORY" type="TEXT">
  A Truss directory. Defaults to current directory.
</ParamField>

<ParamField body="BUILD_DIR" type="TEXT">
  Image context directory. If not provided, a temp directory is created.
</ParamField>

**Example:**

Build and run a Truss locally:

```sh theme={"system"}
truss image run
```

Run on a custom port:

```sh theme={"system"}
truss image run --port 9000
```

Run in attached mode:

```sh theme={"system"}
truss image run --attach
```
