> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup Docker

> Install Docker Engine and the Compose plugin on Ubuntu for an Overleaf deployment.

Overleaf runs on Docker. You must install:

* Docker Engine (Docker CE)
* Docker Compose plugin (`docker compose`, v2)

These steps target a recent Ubuntu LTS (20.04/22.04/24.04).

<Warning>
  Avoid installing `docker.io` from Ubuntu's default apt repository.\
  Use Docker's official repository so you get a recent Docker version and the `docker compose` plugin.
</Warning>

The official document comes from: [https://docs.docker.com/engine/install/ubuntu/](https://docs.docker.com/engine/install/ubuntu/).

<Steps>
  <Step title="1) Remove old/conflicting packages (if present)">
    If Docker was previously installed from another source, remove it first:

    ```bash wrap theme={null}
    sudo apt remove $(dpkg --get-selections docker.io docker-compose docker-compose-v2 docker-doc podman-docker containerd runc | cut -f1)
    ```

    This command is safe if some packages are not installed.
  </Step>

  <Step title="2) Add Docker’s official apt repository">
    Install prerequisites:

    ```bash theme={null}
    sudo apt update
    sudo apt install -y ca-certificates curl
    ```

    Add the Docker GPG key:

    ```bash wrap theme={null}
    sudo install -m 0755 -d /etc/apt/keyrings
    sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
    sudo chmod a+r /etc/apt/keyrings/docker.asc
    ```

    Add the repository:

    ```bash wrap theme={null}
    # Add the repository to Apt sources:
    sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
    Types: deb
    URIs: https://download.docker.com/linux/ubuntu
    Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
    Components: stable
    Signed-By: /etc/apt/keyrings/docker.asc
    EOF

    sudo apt update
    ```
  </Step>

  <Step title="3) Install Docker Engine + Compose plugin">
    Install Docker and the Compose plugin:

    ```bash wrap theme={null}
    sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    ```

    Start Docker on boot:

    ```bash theme={null}
    sudo systemctl enable --now docker
    ```
  </Step>

  <Step title="4) Verify the installation">
    These commands should run without errors:

    ```bash theme={null}
    docker --version
    docker compose version
    sudo docker run --rm hello-world
    docker ps
    ```
  </Step>

  <Step title="5) (Optional) Run Docker without sudo">
    Add your user to the `docker` group:

    ```bash theme={null}
    sudo usermod -aG docker $USER
    ```

    Then **log out and back in**, or run:

    ```bash theme={null}
    newgrp docker
    ```

    Now this should work without `sudo`:

    ```bash theme={null}
    docker ps
    ```

    <Danger>
      The `docker` group has root-equivalent access on the host.\
      This is expected for typical Overleaf installs, and especially relevant if you enable Sandboxed Compiles.
    </Danger>
  </Step>
</Steps>

### Next step

Once Docker is working, continue with the Toolkit installation steps in [Using the Toolkit](/on-premises/installation/using-the-toolkit).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.