Browse Source

fix: 解决容器镜像加速或仓库空行导致 Docker 无法正常启用的问题 (#1437)

pull/1440/head
ssongliu 1 year ago committed by GitHub
parent
commit
7546391c17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      backend/app/service/docker.go
  2. 4
      frontend/src/components/upload/index.vue

2
backend/app/service/docker.go

@ -136,12 +136,14 @@ func (u *DockerService) UpdateConf(req dto.SettingUpdate) error {
switch req.Key { switch req.Key {
case "Registries": case "Registries":
req.Value = strings.TrimRight(req.Value, ",")
if len(req.Value) == 0 { if len(req.Value) == 0 {
delete(daemonMap, "insecure-registries") delete(daemonMap, "insecure-registries")
} else { } else {
daemonMap["insecure-registries"] = strings.Split(req.Value, ",") daemonMap["insecure-registries"] = strings.Split(req.Value, ",")
} }
case "Mirrors": case "Mirrors":
req.Value = strings.TrimRight(req.Value, ",")
if len(req.Value) == 0 { if len(req.Value) == 0 {
delete(daemonMap, "registry-mirrors") delete(daemonMap, "registry-mirrors")
} else { } else {

4
frontend/src/components/upload/index.vue

@ -18,13 +18,13 @@
:stroke-width="12" :stroke-width="12"
:percentage="uploadPrecent" :percentage="uploadPrecent"
></el-progress> ></el-progress>
<div v-if="type === 'mysql'" class="el-upload__tip"> <div v-if="type === 'mysql'" style="width: 80%" class="el-upload__tip">
<span class="input-help">{{ $t('database.supportUpType') }}</span> <span class="input-help">{{ $t('database.supportUpType') }}</span>
<span class="input-help"> <span class="input-help">
{{ $t('database.zipFormat') }} {{ $t('database.zipFormat') }}
</span> </span>
</div> </div>
<div v-else class="el-upload__tip"> <div v-else style="width: 80%" class="el-upload__tip">
<span class="input-help">{{ $t('website.supportUpType') }}</span> <span class="input-help">{{ $t('website.supportUpType') }}</span>
<span class="input-help"> <span class="input-help">
{{ $t('website.zipFormat', [type + '.json']) }} {{ $t('website.zipFormat', [type + '.json']) }}

Loading…
Cancel
Save