# Set up with Docker

!!! important Docker Compose version 1.29.0 or later is required to use version 3.9 of the Compose file format. You can check the version of Docker Compose installed on your system by running the following command:

````
```shell
docker compose version
```

This will display the version of Docker Compose that is currently installed on your system.

If you need to upgrade Docker Compose to a newer version, you can follow the installation instructions in the Docker documentation: https://docs.docker.com/compose/install/
````

## Basic Setup

1. Make sure you have Docker installed, see [requirements](https://agpt.co/docs/classic/autogpt-classic-agent-setup#requirements)
2. Create a project directory for AutoGPT

   ```shell
   mkdir AutoGPT
   cd AutoGPT
   ```
3. In the project directory, create a file called `docker-compose.yml`:
4. Download [`.env.template`](https://github.com/Significant-Gravitas/AutoGPT/tree/master/classic/original_autogpt/.env.template) and save it as `.env` in the AutoGPT folder.
5. Follow the standard [configuration instructions](https://agpt.co/docs/classic/autogpt-classic-agent-setup#completing-the-setup), from step 3 onwards and excluding `poetry install` steps.
6. Pull the latest image from [Docker Hub](https://hub.docker.com/r/significantgravitas/auto-gpt)

   ```shell
   docker pull significantgravitas/auto-gpt
   ```
7. *Optional: mount configuration file.* If you have component configuration file, for example `config.json`, place it in `classic/original_autogpt/data/` directory. Or place it in `classic/original_autogpt/` and uncomment the line in `docker-compose.yml` that mounts it. To learn more about configuring, see [Component configuration](https://github.com/gitbook-dave/AutoGPT/blob/master/docs/content/forge/components/components.md#json-configuration)

!!! note "Docker only supports headless browsing" AutoGPT uses a browser in headless mode by default: `HEADLESS_BROWSER=True`. Please do not change this setting in combination with Docker, or AutoGPT will crash.

## Developer Setup

!!! tip Use this setup if you have cloned the repository and have made (or want to make) changes to the codebase.

1. Copy `.env.template` to `.env`.
2. Follow the standard [configuration instructions](https://agpt.co/docs/classic/autogpt-classic-agent-setup#completing-the-setup), from step 3 onwards and excluding `poetry install` steps.

## Running AutoGPT with Docker

After following setup instructions above, you can run AutoGPT with the following command:

```shell
docker compose run --rm auto-gpt
```

This creates and starts an AutoGPT container, and removes it after the application stops. This does not mean your data will be lost: data generated by the application is stored in the `data` folder.

Subcommands and arguments work the same as described in the [user guide](https://agpt.co/docs/classic/usage#command-line-interface):

* Run AutoGPT:

  ```shell
  docker compose run --rm auto-gpt serve
  ```
* Run AutoGPT in TTY mode, with continuous mode.

  ```shell
  docker compose run --rm auto-gpt run --continuous
  ```
* Run AutoGPT in TTY mode and install dependencies for all active plugins:

  ```shell
  docker compose run --rm auto-gpt run --install-plugin-deps
  ```

If you dare, you can also build and run it with "vanilla" docker commands:

```shell
docker build -t autogpt .
docker run -it --env-file=.env -v $PWD:/app autogpt
docker run -it --env-file=.env -v $PWD:/app --rm autogpt --gpt3only --continuous
```
