> For the complete documentation index, see [llms.txt](https://affine.gitbook.io/affine/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://affine.gitbook.io/affine/getting-started/install-affine-with-docker.md).

# Install AFFiNE with Docker

This guide assumes you already have an environment setup running docker.

Currently there are two main versions:

1. AFFiNE Alpha - The latest version in active development. `affine-self-hosted:latest`
2. AFFiNE Pre-Alpha - Previous release which is no longer developed, but offers different functionality. `affine-self-hosted:pre-alpha`

Simply swap out the Docker image for which version you require, the following instructions default to the latest image.

### Installing AFFiNE using Docker

1. Pull the latest AFFiNE image. This may take some time depending on your network connection.

```
docker pull ghcr.io/toeverything/affine-self-hosted:latest
```

Ensure this step is completed successfully before continuing (you can rerun this command if you are unsure).

***

1. Next we will run the AFFiNE project in Docker.

```
docker run -it --name affine -d -v YOUR_PATH:/app/data -p 3000:3000 ghcr.io/toeverything/affine-self-hosted:latest
```

* `--name` Optional - this makes it convenient for using and interacting with your Docker container - such as `docker restart affine`.
* `-v` Optional - allows you to mount your data outside of Docker to your local machine. Remember to set `YOUR_PATH` to the directory of your choice.
* `-p` Required - this sets the port for where AFFiNE is running and listening, we use the default 3000 if you need to change this only change the first number e.g. `[YOUR_PORT]:3000`
* Finally, the image id is the version of AFFiNE you wish to deploy. Following this guide, it would be the same as the previous step - so `ghcr.io/toeverything/affine-self-hosted:latest`

***

1. You can confirm that AFFiNE is running successfully by using the command

```
docker ps
```

This command shows a list of running containers - in the list you should be able to find AFFiNE.

***

* Now you can access AFFiNE from your browser via:
  * If you are running Docker on your local machine and using the default settings you can access via port 3000 through localhost: <http://localhost:3000/>
  * Otherwise you will need to know the {IP} of the machine using Docker and the {PORT} that AFFiNE is using.
  * Bear in mind that some features require a secure environment to work, which means https and wss connections through a reverse proxy setup. For more support you may wish to find our community page: [AFFiNE Community](https://community.affine.pro)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://affine.gitbook.io/affine/getting-started/install-affine-with-docker.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
