Skip to content

Commit c3d869e

Browse files
committed
feat: 引入 i18n 消息系统并更新 README 以支持非交互式模式和多语言文档。
1 parent dcff530 commit c3d869e

2 files changed

Lines changed: 875 additions & 420 deletions

File tree

README.md

Lines changed: 114 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,170 @@
11
# EasyDocker
22

3-
Docker 一键安装配置脚本,为不受 Docker 官方安装脚本支持的 Linux 发行版提供安装支持。
3+
One-click Docker installation script for Linux distros not covered by the official Docker install script.
44

5-
## 快速开始
5+
## Quick Start
66

77
```bash
88
bash <(curl -sSL https://raw.githubusercontent.com/web-casa/easydocker/main/docker.sh)
99
```
1010

11-
如果使用 `wget`
11+
Or with `wget`:
1212

1313
```bash
1414
bash <(wget -qO- https://raw.githubusercontent.com/web-casa/easydocker/main/docker.sh)
1515
```
1616

17-
> 国内服务器如果无法访问 GitHub,可使用 ghproxy 等加速服务,或先手动下载 `docker.sh` 再执行。
18-
19-
## 功能模式
20-
21-
脚本运行后会提示选择操作模式:
17+
## Usage
2218

2319
```
24-
请选择操作模式:
25-
1) 一键安装配置(推荐)
26-
2) 修改镜像加速域名
20+
bash docker.sh [OPTIONS]
21+
22+
Options:
23+
--lang en|zh UI language (default: en)
24+
--mirror <value> Mirror config: none, public, or a custom domain
25+
(default: none — uses Docker official registry)
26+
--mode <value> Operation mode: install or mirror
27+
-y, --yes Skip interactive confirmations
28+
-h, --help Show help message
2729
```
2830

29-
### 模式 1:一键安装配置
31+
### Examples
3032

31-
完整的 Docker 安装流程,包括:
33+
```bash
34+
# Interactive mode (English, default)
35+
bash docker.sh
3236

33-
1. 检测系统发行版并自动配置对应的 Docker CE 仓库
34-
2. 安装 Docker CE + Docker Compose
35-
3. 配置镜像加速(见下方说明)
36-
4. 启动 Docker 服务并配置开机自启
37+
# Interactive mode (Chinese)
38+
bash docker.sh --lang zh
3739

38-
### 模式 2:仅修改镜像加速域名
40+
# Non-interactive install, no mirror
41+
bash docker.sh --mode install --yes
3942

40-
适用于已安装 Docker、仅需更新镜像加速配置的场景。
43+
# Non-interactive install with public mirror acceleration
44+
bash docker.sh --mode install --mirror public --yes
4145

42-
## 镜像加速配置
46+
# Non-interactive install with custom mirror
47+
bash docker.sh --mode install --mirror hub.example.com --yes
4348

44-
安装过程中(或模式 2)会提示选择镜像加速方案:
49+
# Change mirror config only (interactive)
50+
bash docker.sh --mode mirror
4551

52+
# Change mirror config only (non-interactive)
53+
bash docker.sh --mode mirror --mirror public
4654
```
47-
请选择镜像加速版本:
48-
1) 使用公共加速域名 (docker.m.daocloud.io)
49-
2) 使用自定义加速域名 (自定义 + docker.m.daocloud.io)
50-
```
5155

52-
- **选项 1**:使用 DaoCloud 公共镜像加速,无需任何配置,开箱即用
53-
- **选项 2**:填入你自己的镜像加速域名(如企业内部加速、自建代理等),脚本会将自定义域名设为优先,DaoCloud 作为兜底
56+
## Operation Modes
57+
58+
### Mode: Install (`--mode install`)
59+
60+
Full Docker installation flow:
61+
62+
1. Detect Linux distro and configure the appropriate Docker CE repository
63+
2. Install Docker CE + Docker Compose
64+
3. Start Docker service and enable autostart
65+
4. (Optional) Configure mirror acceleration
66+
5. Configure user permissions
67+
68+
### Mode: Mirror (`--mode mirror`)
69+
70+
For servers with Docker already installed — update mirror acceleration config only.
71+
72+
## Mirror Acceleration
73+
74+
By default, the script uses Docker's official registry (no mirrors). This is the best choice for servers outside China.
75+
76+
For servers in China, use `--mirror` to configure acceleration:
5477

55-
配置完成后,脚本会自动写入 `/etc/docker/daemon.json` 并重启 Docker 服务使其生效。
78+
| Value | Behavior |
79+
|-------|----------|
80+
| `none` (default) | No mirror, use Docker official registry |
81+
| `public` | Use DaoCloud public mirror (`docker.m.daocloud.io`) |
82+
| `<domain>` | Use custom domain as priority, DaoCloud as fallback |
5683

57-
生成的配置示例(选项 2,自定义域名为 `your-mirror.example.com`):
84+
In interactive mode, the script presents three choices:
85+
86+
```
87+
1) No mirror acceleration (default)
88+
2) Use public mirror (docker.m.daocloud.io)
89+
3) Use custom mirror domain
90+
```
91+
92+
Example `daemon.json` when using `--mirror hub.example.com`:
5893

5994
```json
6095
{
61-
"registry-mirrors": ["https://your-mirror.example.com", "https://docker.m.daocloud.io"],
62-
"insecure-registries": ["your-mirror.example.com"]
96+
"registry-mirrors": ["https://hub.example.com", "https://docker.m.daocloud.io"],
97+
"insecure-registries": ["hub.example.com"]
6398
}
6499
```
65100

66-
## 安装源自动切换
67-
68-
脚本内置多个国内镜像源,按以下顺序依次尝试,确保在各种网络环境下都能完成安装:
69-
70-
1. 阿里云镜像
71-
2. 腾讯云镜像
72-
3. 华为云镜像
73-
4. 中科大镜像
74-
5. 清华大学镜像
75-
6. Docker 官方源
101+
## Supported Distributions
76102

77-
## 支持的发行版
103+
### RPM-based (CentOS-compatible repo)
78104

79-
### RPM 系(使用 CentOS 兼容仓库)
80-
81-
| 发行版 | 支持版本 | 仓库映射 |
82-
|--------|----------|----------|
83-
| CentOS / RHEL | 8, 9, 10 | 对应 el8/el9/el10 |
84-
| Rocky Linux | 8, 9 | 对应 el8/el9 |
85-
| AlmaLinux | 8, 9 | 对应 el8/el9 |
86-
| Oracle Linux | 8, 9 | 对应 el8/el9 |
105+
| Distribution | Versions | Repo Mapping |
106+
|-------------|----------|--------------|
107+
| CentOS / RHEL | 8, 9, 10 | el8/el9/el10 |
108+
| Rocky Linux | 8, 9 | el8/el9 |
109+
| AlmaLinux | 8, 9 | el8/el9 |
110+
| Oracle Linux | 8, 9 | el8/el9 |
87111
| openEuler | 20+ | 20→el8, 22+→el9 |
88-
| OpenCloudOS | 9 | el9 兼容 |
112+
| OpenCloudOS | 9 | el9 |
89113
| Anolis OS | 8, 23 | 8→el8, 23→el9 |
90-
| Alibaba Cloud Linux | 3+ | el8 兼容 |
91-
| 银河麒麟 (Kylin) | V10+ | el8 兼容 |
92-
| Fedora | 最新版 | 使用 Fedora 仓库 |
114+
| Alibaba Cloud Linux | 3+ | el8 |
115+
| Kylin | V10+ | el8 |
116+
| Fedora | Latest | Fedora repo |
93117

94-
### Debian 系(使用 APT 仓库)
118+
### Debian-based (APT repo)
95119

96-
| 发行版 | 支持版本 |
97-
|--------|----------|
120+
| Distribution | Versions |
121+
|-------------|----------|
98122
| Ubuntu | 18.04, 20.04, 22.04, 24.04+ |
99123
| Debian | 11 (Bullseye), 12 (Bookworm), 13 (Trixie) |
100-
| Kali Linux | 最新版(使用 Debian 兼容仓库) |
124+
| Kali Linux | Latest (Debian-compatible repo) |
125+
126+
### Non-Linux
127+
128+
macOS and Windows users will see platform-specific Docker Desktop installation guidance.
129+
130+
## Install Source Failover
131+
132+
The script tries multiple mirror sources in order for best network compatibility:
101133

102-
### 非 Linux 系统
134+
1. Alibaba Cloud Mirror
135+
2. Tencent Cloud Mirror
136+
3. Huawei Cloud Mirror
137+
4. USTC Mirror
138+
5. Tsinghua University Mirror
139+
6. Docker Official
103140

104-
macOS 和 Windows 用户运行脚本后会显示对应平台的安装指引(Docker Desktop)。
141+
## Features
105142

106-
## 特性
143+
- Multi-source automatic failover for package downloads
144+
- Automatic fallback to binary install if package manager fails
145+
- Docker Compose v2 auto-install
146+
- Optional mirror acceleration (default: none)
147+
- i18n support (English / Chinese)
148+
- Non-interactive mode for automation (`--mode install --yes`)
149+
- CI validation (17-distro matrix + ShellCheck)
107150

108-
- 多镜像源自动切换(阿里云 → 腾讯云 → 华为云 → 中科大 → 清华 → 官方)
109-
- 包管理器安装失败时自动回退到二进制安装
110-
- Docker Compose v2 自动安装
111-
- 镜像加速自动配置(公共 / 自定义域名)
112-
- CI 自动验证(17 个发行版矩阵 + ShellCheck 静态分析)
151+
## Development
113152

114-
## 本地测试
153+
### Run tests locally
115154

116155
```bash
117156
bash tests/run_os_matrix.sh
118157
```
119158

120-
## CI
159+
### CI
121160

122-
- 工作流文件:`.github/workflows/os-compat-ci.yml`
123-
- 触发条件:`push` / `pull_request` `main`
124-
- 测试矩阵:
125-
- **ShellCheck**静态分析
126-
- **RPM 矩阵** — Rocky 8/9, CentOS Stream 10, Alma 8/9, Oracle 8/9, Anolis 23, OpenCloudOS 9, openEuler 24.03
127-
- **Debian 矩阵** — Ubuntu 24.04/22.04/20.04, Debian 12/11
128-
- **Fedora 矩阵** — Fedora 41/40
161+
- Workflow: `.github/workflows/os-compat-ci.yml`
162+
- Trigger: `push` / `pull_request` to `main`
163+
- Jobs:
164+
- **ShellCheck**Static analysis
165+
- **RPM Matrix** — Rocky 8/9, CentOS Stream 10, Alma 8/9, Oracle 8/9, Anolis 23, OpenCloudOS 9, openEuler 24.03
166+
- **Debian Matrix** — Ubuntu 24.04/22.04/20.04, Debian 12/11
167+
- **Fedora Matrix** — Fedora 41/40
129168

130169
## License
131170

0 commit comments

Comments
 (0)