# JetStream

In one window start a JetStream enabled nats server:

```shell
docker run --network host -p 4222:4222 nats -js
```

And make sure you have the CLI tools [`nats`](https://github.com/natsclub/nats.docs/blob/main/using-nats/nats-tools/nats%20CLI/readme.md) and [`nsc`](/cn/shi-yong-nats/nats-tools/nsc.md) installed

Now skip to the [`Administer JetStream`](/cn/yun-xing-yi-ge-nats-fu-wu/nats_admin/jetstream_admin.md) section.

## Using Docker with NGS

You can join a JetStream instance to your [NGS](https://synadia.com/ngs/pricing) account, first we need a credential for testing JetStream:

You'll want to do this outside of docker to keep the credentials that are generated.

```shell
nsc add user -a YourAccount --name leafnode --expiry 1M
```

You'll get a credential file somewhere like `~/.nkeys/creds/synadia/YourAccount/leafnode.creds`, mount this file into the docker container for JetStream using `-v ~/.nkeys/creds/synadia/YourAccount/leafnode.creds:/leafnode.creds`.

```shell
docker run -ti -v ~/.nkeys/creds/synadia/YourAccount/leafnode.creds:/leafnode.creds --name jetstream nats:latest
```

```
[1] 2021/10/08 21:48:51.426008 [INF] Starting nats-server
[1] 2021/10/08 21:48:51.426091 [INF]   Version:  2.6.1
...
[1] 2021/10/08 21:48:51.849033 [INF] Connected leafnode to "connect.ngs.global"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.natsclub.cn/cn/yun-xing-yi-ge-nats-fu-wu/nats_docker/jetstream_docker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
