> For the complete documentation index, see [llms.txt](https://ayakaleaf-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://ayakaleaf-pro.ayaka.space/on-premises/ja/insutru/setup-docker.md).

# Docker のセットアップ

Overleaf は Docker 上で動作します。次のものをインストールする必要があります:

* Docker Engine (Docker CE)
* Docker Compose プラグイン（`docker compose`、v2）

これらの手順は、最近の Ubuntu LTS（20.04/22.04/24.04）を対象としています。

{% hint style="warning" %}
のインストールは避けてください `docker.io` Ubuntu の既定の apt リポジトリから。\
最新の Docker バージョンと次のものを取得できるように、Docker の公式リポジトリを使用してください `docker compose` プラグイン。
{% endhint %}

公式ドキュメントは次のページから: <https://docs.docker.com/engine/install/ubuntu/>.

{% stepper %}
{% step %}

### 1) 古い／競合するパッケージを削除する（存在する場合）

Docker が以前に別のソースからインストールされていた場合は、まずそれを削除してください:

{% 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 %}

一部のパッケージがインストールされていなくても、このコマンドは安全です。
{% endstep %}

{% step %}

### 2) Docker の公式 apt リポジトリを追加する

前提条件をインストールします:

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

Docker の GPG キーを追加します:

{% 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 %}

リポジトリを追加します:

{% code overflow="wrap" %}

```bash
# リポジトリを Apt ソースに追加します:
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
```

{% endcode %}
{% endstep %}

{% step %}

### 3) Docker Engine + Compose プラグインをインストールする

Docker と Compose プラグインをインストールします:

{% code overflow="wrap" %}

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

{% endcode %}

起動時に Docker を開始する:

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

{% endstep %}

{% step %}

### 4) インストールを確認する

次のコマンドはエラーなく実行できるはずです:

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

{% endstep %}

{% step %}

### 5) （任意）sudo なしで Docker を実行する

ユーザーを次の `docker` グループに追加します:

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

その後 **ログアウトして再度ログインする**、または次を実行します:

```bash
newgrp docker
```

これで次のものなしで動作するはずです `sudo`:

```bash
docker ps
```

{% hint style="danger" %}
この `docker` グループはホスト上で root 相当のアクセス権を持ちます。\
これは一般的な Overleaf のインストールでは想定される動作であり、Sandboxed Compiles を有効にする場合は特に重要です。
{% endhint %}
{% endstep %}
{% endstepper %}

### 次のステップ

Docker が動作したら、次の Toolkit のインストール手順に進んでください: [Toolkit の使用](/on-premises/ja/insutru/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://ayakaleaf-pro.ayaka.space/on-premises/ja/insutru/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.
