> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/on-premises/pt/comecar/requirements/setup-docker.md).

# Configurar o Docker

O Overleaf funciona com Docker. Você deve instalar:

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

Estes passos destinam-se a um Ubuntu LTS recente (20.04/22.04/24.04).

{% hint style="warning" %}
Evite instalar `docker.io` do repositório apt padrão do Ubuntu.\
Use o repositório oficial da Docker para obter uma versão recente do Docker e o `docker compose` plugin.
{% endhint %}

A documentação oficial vem de: <https://docs.docker.com/engine/install/ubuntu/>.

{% stepper %}
{% step %}

### 1) Remover pacotes antigos/conflitantes (se existirem)

Se o Docker tiver sido instalado anteriormente de outra fonte, remova-o primeiro:

{% code overflow="wrap" %}

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

{% endcode %}

Este comando é seguro se alguns pacotes não estiverem instalados.
{% endstep %}

{% step %}

### 2) Adicionar o repositório apt oficial da Docker

Instale os pré-requisitos:

```bash
sudo apt update
sudo apt install -y ca-certificates curl
```

Adicione a chave GPG da Docker:

{% code overflow="wrap" %}

```bash
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
```

{% endcode %}

Adicione o repositório:

{% code overflow="wrap" %}

```bash
# Adicione o repositório às fontes do Apt:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Tipos: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Componentes: stable
Assinado-por: /etc/apt/keyrings/docker.asc
EOF

sudo apt update
```

{% endcode %}
{% endstep %}

{% step %}

### 3) Instalar o Docker Engine + o plugin do Compose

Instale o Docker e o plugin do Compose:

{% code overflow="wrap" %}

```bash
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
```

{% endcode %}

Inicie o Docker na inicialização:

```bash
sudo systemctl enable --now docker
```

{% endstep %}

{% step %}

### 4) Verifique a instalação

Estes comandos devem ser executados sem erros:

```bash
docker --version
docker compose version
sudo docker run --rm hello-world
docker ps
```

{% endstep %}

{% step %}

### 5) (Opcional) Executar o Docker sem sudo

Adicione o seu utilizador ao `docker` grupo:

```bash
sudo usermod -aG docker $USER
```

Depois **termine sessão e volte a iniciá-la**, ou execute:

```bash
newgrp docker
```

Agora isto deve funcionar sem `sudo`:

```bash
docker ps
```

{% hint style="danger" %}
O `docker` o grupo tem acesso equivalente ao root no anfitrião.\
Isto é esperado para instalações típicas do Overleaf, e especialmente relevante se ativar Sandboxed Compiles.
{% endhint %}
{% endstep %}
{% endstepper %}

### Próximo passo

Assim que o Docker estiver a funcionar, continue com os passos de instalação do Toolkit em [Usando o Toolkit](/on-premises/pt/instalacao/using-the-toolkit.md).


---

# 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://overleaf-pro.ayaka.space/on-premises/pt/comecar/requirements/setup-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.
