11# 面板控制命令 <Badge type =" tip " text =" DPanel Version >= 1.2.2 " />
22
3- ::: tip
4- 控制命令需要进入 DPanel 面板容器运行。如果你更改了 DPanel 面板的容器名称,请将下方命令中的 ** dpanel** 替换成你的面板容器名字
5- :::
6-
73## 调用方式
84
5+ 执行命令时根据当前的执行环境,请修改示例代码执行。
6+
97### 在宿主机中调用
108
9+ ::: tip
10+ 实际运行时,请将下方命令中的 ** dpanel** 替换成你的面板容器名字
11+ :::
12+
11131 . 登录服务器的 ssh
12142 . 通过 docker exec 命令执行 DPanel 容器中的控制命令
13153 . 根据需求,执行对应的命令
1416
15- ### 在计划任务中调用
17+ ```
18+ docker exec dpanel /app/server/dpanel -f /app/server/config.yaml user:reset
19+ ```
20+
21+ ### 计划任务与二进制调用
1622
17- 必须指定运行容器为 DPanel 容器
23+ ::: tip
24+ 计划任务中调用时,执行容器留空或是指定为 DPanel 容器
25+ :::
1826
1927```
2028/app/server/dpanel -f /app/server/config.yaml user:reset
2735将使用随机密码重置用户
2836
2937```
30- docker exec dpanel ./dpanel -f config.yaml user:reset
38+ ./dpanel -f config.yaml user:reset
3139```
3240
3341### 重置密码
3442
3543```
36- docker exec dpanel ./dpanel -f config.yaml user:reset --password 123456
44+ ./dpanel -f config.yaml user:reset --password 123456
3745```
3846
3947### 重置用户名
4048
4149重置用户名时,必须指定密码
4250
4351```
44- docker exec dpanel ./dpanel -f config.yaml user:reset user:reset --password 123456 --username root
52+ ./dpanel -f config.yaml user:reset user:reset --password 123456 --username root
4553```
4654
4755## 更新应用商店数据
4856
4957- \- -name 指定应用商店名称
5058
5159```
52- docker exec dpanel ./dpanel -f config.yaml store:sync --name 应用商店标识
60+ ./dpanel -f config.yaml store:sync --name test
5361```
5462
5563### 返回
@@ -58,13 +66,13 @@ docker exec dpanel ./dpanel -f config.yaml store:sync --name 应用商店标识
5866{"total":151}
5967```
6068
61- ## 检测容器镜像是否有新版
69+ ## 检测容器更新
6270
6371- \- -name 指定检测的容器名称
64- - \- -docker-env 指定 docker env 环境名称
72+ - \- -docker-env 指定 docker env 环境名称,默认: local
6573
6674```
67- docker exec dpanel ./dpanel -f config.yaml container:upgrade --name 容器名称 --docker-env local
75+ ./dpanel -f config.yaml container:upgrade --name containerName --docker-env local
6876```
6977
7078### 返回
@@ -75,14 +83,16 @@ docker exec dpanel ./dpanel -f config.yaml container:upgrade --name 容器名称
7583{"upgrade":false,"digest":"sha256:8f4ac2974ff707bace98ab14923fdf220f44a9803045b655f1d8d3e098f97e55","digestLocal":["registry.cn-hangzhou.aliyuncs.com/dpanel/dpanel@sha256:8f4ac2974ff707bace98ab14923fdf220f44a9803045b655f1d8d3e098f97e55"]}
7684```
7785
78- ## 当容器有更新时升级容器
86+ ## 升级容器
7987
80- - \- -name 指定检测的容器名称
81- - \- -upgrade 当容器有更新时升级容器
88+ - \- -name 指定容器名称
8289- \- -docker-env 指定 docker env 环境名称
90+ - \- -enable-bak 是否备份旧容器,默认: true
91+ - \- -disable-bak 不备份旧容器,等同于 --enable-bak=false
92+ - \- -image-tag 指定新的镜像名称,此镜像一定要与容器的镜像完全兼容
8393
8494```
85- docker exec dpanel ./dpanel -f config.yaml container:upgrade --name 容器名称 --upgrade
95+ ./dpanel -f config.yaml container:upgrade --upgrade --disable-bak --name containerName
8696```
8797
8898### 返回
@@ -99,9 +109,12 @@ docker exec dpanel ./dpanel -f config.yaml container:upgrade --name 容器名称
99109- \- -name 指定检测的容器名称
100110- \- -docker-env 指定 docker env 环境名称
101111- \- -enable-image 是否备份容器镜像
112+ - \- -backup-image 备份镜像类型 image 或是 container (docker commit)
113+ - \- -enable-volume 是否备份挂载目录
114+ - \- -backup-volume 指定备份的挂载目录
102115
103116```
104- docker exec dpanel ./dpanel -f config.yaml container:backup --name 容器名称 --enable-image 1
117+ ./dpanel -f config.yaml container:backup --name 容器名称 --enable-image --enable-volume
105118```
106119
107120### 返回
@@ -118,7 +131,7 @@ docker exec dpanel ./dpanel -f config.yaml container:backup --name 容器名称
118131- \- -pull-image 指定拉取镜像方式 dpanel command
119132
120133```
121- docker exec dpanel ./dpanel -f config.yaml compose:deploy --name 任务名称 --environment name=test --environment age=10 --pull-image dpanel
134+ ./dpanel -f config.yaml compose:deploy --name 任务名称 --environment name=test --environment age=10 --pull-image dpanel
122135```
123136
124137### 返回
@@ -130,8 +143,11 @@ docker exec dpanel ./dpanel -f config.yaml compose:deploy --name 任务名称 --
130143
131144## 清理系统消息、事件及缓存 <Badge type =" tip " text =" DPanel Version >= 1.9.2 " />
132145
146+ - \- -enable-notice 清除通知和事件
147+ - \- -enable-temp-file 清理临时文件
148+
133149```
134- docker exec dpanel ./dpanel -f config.yaml system:prune
150+ ./dpanel -f config.yaml system:prune
135151```
136152
137153### 返回
@@ -149,7 +165,7 @@ docker exec dpanel ./dpanel -f config.yaml system:prune
149165- \- -channel 通知的方式 email
150166
151167```
152- docker exec dpanel ./dpanel -f config.yaml system:notice --content test123 --target 914417117@qq.com --subject 我来测试一下
168+ ./dpanel -f config.yaml system:notice --content test123 --target 914417117@qq.com --subject 我来测试一下
153169```
154170
155171### 返回
@@ -161,14 +177,14 @@ docker exec dpanel ./dpanel -f config.yaml system:notice --content test123 --ta
161177
162178## 简易缓存数据存储 <Badge type =" tip " text =" DPanel Version >= 1.9.2 " />
163179
164- 利用缓存功能,可以辅助在脚本中做一些数据缓存或是标志位检测
180+ 利用缓存数据存储功能,可以脚本中做一些数据缓存或是标志位检测。
165181
166182- \- -key 缓存名称
167183- \- -value 缓存内容,为空时获取 --key 的内容
168- - \- -keep 缓存生命周期,默认为 -1 直到主程序重启
184+ - \- -keep 缓存生命周期(秒) ,默认为 -1 直到主程序重启
169185
170186```
171- docker exec dpanel ./dpanel -f config.yaml system:cache --key test1 --value 123
187+ ./dpanel -f config.yaml system:cache --key test1 --value 123
172188```
173189
174190### 返回
0 commit comments