Skip to content

Control a real USB-connected iPhone from Linux (no Mac, no paid developer account) and expose it to AI agents as MCP tools

文档:新增只写 compose 文件的部署方式

Derrors119ea67c4546
diff --git a/README.md b/README.md
index a1390a9..ef29abf 100644
--- a/README.md
+++ b/README.md
@@ -89,7 +89,7 @@ Open a new Claude Code session and ask, for example:
> { "mcpServers": { "iphone": { "command": "docker", "args": ["exec", "-i", "iphone-control", "iphone-control", "mcp"] } } }
> ```
-Once a release is out you can skip the build: set `IMAGE=ghcr.io/derrors/iphone-control:latest` in `.env` and run `docker compose pull && docker compose up -d --no-build`. Without Docker, use a [prebuilt binary or build from source](https://derrors.github.io/iphone-control/en/deploy/source) and run it as a systemd user service.
+You can also skip both the clone and the build: in a new directory, write a `compose.yaml` that uses the prebuilt image `ghcr.io/derrors/iphone-control:latest` and run `docker compose up -d` — see [Docker](https://derrors.github.io/iphone-control/en/deploy/docker#just-a-compose-file) for the full example. If you already cloned the repository, set `IMAGE=ghcr.io/derrors/iphone-control:latest` in `.env` and run `docker compose pull && docker compose up -d --no-build`. Without Docker, use a [prebuilt binary or build from source](https://derrors.github.io/iphone-control/en/deploy/source) and run it as a systemd user service.
## MCP Tools
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 34b6b6d..9e7bbd1 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -89,7 +89,7 @@ claude mcp add iphone -s user -- docker exec -i iphone-control iphone-control mc
> { "mcpServers": { "iphone": { "command": "docker", "args": ["exec", "-i", "iphone-control", "iphone-control", "mcp"] } } }
> ```
-发布正式版本后可以不自己构建:在 `.env` 里设 `IMAGE=ghcr.io/derrors/iphone-control:latest`,然后 `docker compose pull && docker compose up -d --no-build`。不用 Docker 的话,可以用[预编译二进制或从源码编译](https://derrors.github.io/iphone-control/deploy/source),以 systemd 用户服务运行。
+也可以不克隆仓库、不自己构建:新建一个目录,写一个使用预构建镜像 `ghcr.io/derrors/iphone-control:latest` 的 `compose.yaml`,然后 `docker compose up -d`,完整示例见 [Docker 部署](https://derrors.github.io/iphone-control/deploy/docker#只写一个-compose-文件)。已经克隆了仓库的话,在 `.env` 里设 `IMAGE=ghcr.io/derrors/iphone-control:latest`,然后 `docker compose pull && docker compose up -d --no-build`。不用 Docker 的话,可以用[预编译二进制或从源码编译](https://derrors.github.io/iphone-control/deploy/source),以 systemd 用户服务运行。
## MCP 工具
diff --git a/website/deploy/docker.md b/website/deploy/docker.md
index ae0aa07..a11d38a 100644
--- a/website/deploy/docker.md
+++ b/website/deploy/docker.md
@@ -4,6 +4,46 @@
## 安装
+三种方式任选其一,跑起来的容器完全一样。
+
+### 只写一个 compose 文件
+
+不用克隆仓库,最省事。新建一个目录(例如 `~/iphone-control`),在里面写 `compose.yaml`:
+
+```yaml
+services:
+ iphone:
+ image: ghcr.io/derrors/iphone-control:latest # 或固定版本,例如 :0.1.0
+ container_name: iphone-control
+ # 只开放 USB 字符设备,不需要 privileged
+ device_cgroup_rules:
+ - "c 189:* rmw"
+ init: true
+ stop_grace_period: 30s
+ network_mode: host
+ restart: unless-stopped
+ environment:
+ # 以下都可选,按需取消注释,完整列表见「配置」
+ # HTTP_PROXY: http://127.0.0.1:7890
+ # HTTPS_PROXY: http://127.0.0.1:7890
+ NO_PROXY: localhost,127.0.0.1,::1
+ # BARK_SERVER: https://api.day.app
+ # BARK_KEY: 你的key
+ # TG_BOT_TOKEN: "123456:ABC..."
+ # TG_CHAT_ID: "你的chat id"
+ volumes:
+ - /dev/bus/usb:/dev/bus/usb
+ - ./data:/var/lib/iphone-control
+```
+
+然后在这个目录里:
+
+```bash
+docker compose up -d
+```
+
+`./data` 是相对 `compose.yaml` 所在目录的,里面有配对记录和 Apple ID 会话,**要备份**。环境变量也可以不写在 `environment:` 里,改成放进同目录的 `.env`、再加一段 `env_file: .env`;`.env` 里有通知密钥时,别提交到 git。各变量的含义见[配置](../guide/configuration)。
+
### 自己构建
```bash
@@ -38,12 +78,16 @@ docker compose pull && docker compose up -d --no-build
## 升级
```bash
+docker compose pull && docker compose up -d # 只写 compose 文件
+# 或
git pull
docker compose up -d --build # 自己构建
# 或
docker compose pull && docker compose up -d --no-build # 预构建镜像
```
+镜像标签写的是固定版本时,先把 `compose.yaml` 里的版本号改成新版本再 `pull`。
+
数据在 `./data`,升级不受影响。容器重启后,AI 客户端里的 MCP 连接会断开,重新连接即可(Claude Code 里运行 `/mcp`)。
::: tip 重启后先等就绪
diff --git a/website/en/deploy/docker.md b/website/en/deploy/docker.md
index b253758..86352ce 100644
--- a/website/en/deploy/docker.md
+++ b/website/en/deploy/docker.md
@@ -4,6 +4,46 @@ The recommended way to run it. The image holds one Rust binary plus Debian's usb
## Install
+Pick any one of the three; they all end up with the same container.
+
+### Just a compose file
+
+No need to clone the repository — the least effort. Create a directory (e.g. `~/iphone-control`) and put a `compose.yaml` in it:
+
+```yaml
+services:
+ iphone:
+ image: ghcr.io/derrors/iphone-control:latest # or pin a version, e.g. :0.1.0
+ container_name: iphone-control
+ # USB character devices only; no privileged needed
+ device_cgroup_rules:
+ - "c 189:* rmw"
+ init: true
+ stop_grace_period: 30s
+ network_mode: host
+ restart: unless-stopped
+ environment:
+ # All optional — uncomment what you need; see "Configuration" for the full list
+ # HTTP_PROXY: http://127.0.0.1:7890
+ # HTTPS_PROXY: http://127.0.0.1:7890
+ NO_PROXY: localhost,127.0.0.1,::1
+ # BARK_SERVER: https://api.day.app
+ # BARK_KEY: your-key
+ # TG_BOT_TOKEN: "123456:ABC..."
+ # TG_CHAT_ID: "your chat id"
+ volumes:
+ - /dev/bus/usb:/dev/bus/usb
+ - ./data:/var/lib/iphone-control
+```
+
+Then, in that directory:
+
+```bash
+docker compose up -d
+```
+
+`./data` is relative to the directory holding `compose.yaml`; it contains the pairing records and the Apple ID session, so **back it up**. Instead of `environment:` you can put the variables in a `.env` next to it and add `env_file: .env`; if it holds notification keys, keep it out of git. See [Configuration](../guide/configuration) for what each variable does.
+
### Build it yourself
```bash
@@ -38,12 +78,16 @@ Afterwards, run the [setup wizard](../guide/getting-started) once.
## Upgrade
```bash
+docker compose pull && docker compose up -d # just a compose file
+# or
git pull
docker compose up -d --build # self-built
# or
docker compose pull && docker compose up -d --no-build # prebuilt image
```
+If the image tag pins a version, change it in `compose.yaml` to the new one before pulling.
+
Data lives in `./data` and is untouched. Restarting the container drops the MCP connection in your AI client; reconnect it (`/mcp` in Claude Code).
::: tip Wait until it's ready
diff --git a/website/en/guide/configuration.md b/website/en/guide/configuration.md
index 21d3fb1..91ea51a 100644
--- a/website/en/guide/configuration.md
+++ b/website/en/guide/configuration.md
@@ -3,6 +3,7 @@
Everything is configured with environment variables, and all of them are optional:
- **Docker:** in `.env` in the repository directory (copied from `.env.example`); apply with `docker compose up -d`.
+- **Just a compose file:** under `environment:` in your `compose.yaml` (or a `.env` next to it plus `env_file`); apply with `docker compose up -d` as well.
- **Source install:** in `~/.config/iphone-control/env` (read by the systemd user service); apply with `systemctl --user restart iphone-control`.
## Common
@@ -29,6 +30,8 @@ Notification variables: see [Notifications](./notifications).
## Docker Compose only
+These apply to the repository's own `compose.yaml`; in a compose file you wrote yourself, edit `container_name`, `image` and `volumes` directly.
+
| Variable | Default | Meaning |
|---|---|---|
| `CONTAINER_NAME` | `iphone-control` | Container name |
diff --git a/website/guide/configuration.md b/website/guide/configuration.md
index 0f1b09d..43f077d 100644
--- a/website/guide/configuration.md
+++ b/website/guide/configuration.md
@@ -3,6 +3,7 @@
全部通过环境变量配置,都可以不填:
- **Docker**:写在仓库目录的 `.env`(从 `.env.example` 复制),改完 `docker compose up -d` 重建容器。
+- **只写 compose 文件**:写在 `compose.yaml` 的 `environment:` 里(或同目录的 `.env` 加 `env_file`),改完同样 `docker compose up -d`。
- **从源码运行**:写在 `~/.config/iphone-control/env`(systemd 用户服务会读),改完 `systemctl --user restart iphone-control`。
## 常用
@@ -29,6 +30,8 @@
## 只给 Docker Compose 用的
+用仓库自带的 `compose.yaml` 时才有这几项;自己写 compose 文件时直接改对应的 `container_name`、`image`、`volumes`。
+
| 变量 | 默认 | 含义 |
|---|---|---|
| `CONTAINER_NAME` | `iphone-control` | 容器名 |