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

# Docker

## Docker

To run the ChatGPT application with Docker, follow these steps:

1. **Provide all necessary credentials** such as API keys, access tokens, and the Mongo Connection String in the `docker-compose.yml` file under the api service.
2. **Run the command** `docker-compose up` to start the application.

Note: MongoDB does not support older ARM CPUs like those found in Raspberry Pis. However, you can make it work by setting MongoDB's version to `mongo:4.4.18` in `docker-compose.yml`, which is the most recent version compatible with such devices.

To download the latest version of ChatGPT's Docker image, please visit the [**chatgptclone/app Tags | Docker Hub**](https://hub.docker.com/r/chatgptclone/app/tags) page.

#### Prerequisites

To use ChatGPT, you need to have the following:

* Node.js >= 19.0.0: <https://nodejs.org/en/download>
* MongoDB installed or [MongoDB Atlas](https://account.mongodb.com/account/login) (required if not using Docker)
  * MongoDB does not support older ARM CPUs like those found in Raspberry Pis. However, you can make it work by setting MongoDB's version to `mongo:4.4.18` in `docker-compose.yml`, which is the most recent version compatible with such devices.
  * If you are using MongoDB Atlas, remove `&w=majority` from the default connection string.
* [OpenAI API key](https://platform.openai.com/account/api-keys)
* BingAI and ChatGPT access tokens (optional, free AIs)

#### Usage

1. **Clone or download** the ChatGPT repository to your desired location using the following command:

```bash
git clone https://github.com/danny-avila/chatgpt-clone.git
```

2. **Create a MongoDB database** by following these steps:

   * Navigate to <https://www.mongodb.com/> and sign in or create an account.
   * Create a new project.
   * Build a database using the free plan and name the cluster (example: chatgpt-clone).
   * Use the "Username and Password" method for authentication.
   * Add your current IP to the access list.
   * In the Database Deployment tab, click on Connect.
   * In the "Choose a connection method" section, select "Connect your application".
   * In the "Driver" dropdown menu, select "Node.js" and in the "Version" dropdown, select "4.1 or later".
   * Copy the connection string, fill in your password, and remove `&w=majority` from the default connection string.

3. If you want to use ChatGPT's free version, follow these steps:

   * Log in to chat.openai.com.
   * Visit <https://chat.openai.com/api/auth/session> to get your access token.
   * Note that there is a high chance of your account being banned with this method. Continue at your own risk.

4. **Get your Bing Access Token** by following these steps:
   * Using MS Edge, navigate to bing.com.
   * Make sure you are logged in.
   * Open the DevTools by pressing F12 on your keyboard.
   * Click on the "Application" tab (On the left of the DevTools).
   * Expand the "Cookies" (Under "Storage").
   * Copy the value of the "\_U" cookie.
