> For AI agents: the complete documentation index is available at https://www.tteam.icu/llms.txt, the full documentation bundle is available at https://www.tteam.icu/llms-full.txt.

# Docker部署指南

以CentOS 7为例

## 安装Docker

```bash
# 更新yum包
yum update -y
# 安装Docker
yum install -y docker
# 启动Docker
systemctl start docker                                                          
# 设置Docker开机自启
systemctl enable docker
```

## 实用技巧

### 设置容器开机自启

如果运行容器时忘记设置开机自启，可以执行:

```bash
docker update --restart=always 容器名或者ID
```

### 使用主机网络

```bash
--net=host
```

### 更换阿里云镜像源

编辑配置文件:

```bash
vi /etc/docker/daemon.json
```

添加以下内容:

```json
{"registry-mirrors": ["https://pee6w651.mirror.aliyuncs.com"]}
```

### 安装Docker Compose

```bash
sudo curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
```
