diff --git a/backend/app/dto/container.go b/backend/app/dto/container.go
index cc970b98e..c37fb8275 100644
--- a/backend/app/dto/container.go
+++ b/backend/app/dto/container.go
@@ -36,6 +36,7 @@ type ContainerCreate struct {
PublishAllPorts bool `json:"publishAllPorts"`
ExposedPorts []PortHelper `json:"exposedPorts"`
Cmd []string `json:"cmd"`
+ CPUShares int64 `josn:"cpuShares"`
NanoCPUs int64 `json:"nanoCPUs"`
Memory int64 `json:"memory"`
AutoRemove bool `json:"autoRemove"`
diff --git a/backend/app/service/container.go b/backend/app/service/container.go
index f3df901c2..2f01d2b1e 100644
--- a/backend/app/service/container.go
+++ b/backend/app/service/container.go
@@ -247,6 +247,9 @@ func (u *ContainerService) ContainerCreate(req dto.ContainerCreate) error {
if req.NanoCPUs != 0 {
hostConf.NanoCPUs = req.NanoCPUs * 1000000000
}
+ if req.CPUShares != 0 {
+ hostConf.CPUShares = req.CPUShares
+ }
if req.Memory != 0 {
hostConf.Memory = req.Memory
}
diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts
index 9ec1d7ce1..7409689b0 100644
--- a/frontend/src/lang/modules/en.ts
+++ b/frontend/src/lang/modules/en.ts
@@ -483,6 +483,9 @@ const message = {
cleanLog: 'Clean log',
newName: 'New name',
source: 'Resource rate',
+ cpuShare: 'CPU Share',
+ cpuShareHelper:
+ 'The default CPU share for a container is 1024, which can be increased to give the container more CPU time.',
user: 'User',
command: 'Command',
diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts
index f1f71eca7..a26349acd 100644
--- a/frontend/src/lang/modules/zh.ts
+++ b/frontend/src/lang/modules/zh.ts
@@ -490,6 +490,8 @@ const message = {
cleanLog: '清空日志',
newName: '新名称',
source: '资源使用率',
+ cpuShare: 'CPU 权重',
+ cpuShareHelper: '容器默认份额为 1024 个 CPU,增大可使当前容器获得更多的 CPU 时间',
user: '用户',
command: '命令',
diff --git a/frontend/src/views/container/container/create/index.vue b/frontend/src/views/container/container/create/index.vue
index 7cbcbfdbf..69c8971ae 100644
--- a/frontend/src/views/container/container/create/index.vue
+++ b/frontend/src/views/container/container/create/index.vue
@@ -81,6 +81,10 @@
{{ $t('container.autoRemove') }}
+
+
+ {{ $t('container.cpuShareHelper') }}
+
@@ -202,7 +206,7 @@