feat: 容器创建支持特权模式 (#3021)

This commit is contained in:
ssongliu 2023-11-22 13:58:08 +08:00 committed by GitHub
parent a5a707b923
commit 7972de5f33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 0 deletions

View file

@ -52,6 +52,7 @@ type ContainerOperate struct {
CPUShares int64 `json:"cpuShares"`
NanoCPUs float64 `json:"nanoCPUs"`
Memory float64 `json:"memory"`
Privileged bool `json:"privileged"`
AutoRemove bool `json:"autoRemove"`
Volumes []VolumeHelper `json:"volumes"`
Labels []string `json:"labels"`

View file

@ -937,6 +937,7 @@ func loadConfigInfo(isCreate bool, req dto.ContainerOperate, oldContainer *types
networkConf = network.NetworkingConfig{}
}
hostConf.Privileged = req.Privileged
hostConf.AutoRemove = req.AutoRemove
hostConf.CPUShares = req.CPUShares
hostConf.PublishAllPorts = req.PublishAllPorts

View file

@ -40,6 +40,7 @@ export namespace Container {
cpuShares: number;
memory: number;
volumes: Array<Volume>;
privileged: boolean;
autoRemove: boolean;
labels: Array<string>;
labelsStr: string;

View file

@ -576,6 +576,9 @@ const message = {
custom: 'Custom',
emptyUser: 'When empty, you will log in as default',
containerTerminal: 'Terminal',
privileged: 'Privileged',
privilegedHelper:
'Allows the container to perform certain privileged operations on the host, which may increase container risks. Use with caution!',
upgradeHelper: 'This operation only supports upgrading container versions.',
ignoreCompare: 'Force Upgrade',

View file

@ -560,6 +560,8 @@ const message = {
custom: '自定義',
containerTerminal: '終端',
emptyUser: '為空時將使用容器默認的用戶登錄',
privileged: '特權模式',
privilegedHelper: '允許容器在主機上執行某些特權操作可能會增加容器風險請謹慎開啟',
upgradeHelper: '該操作僅支持容器版本升級',
ignoreCompare: '強製升級',

View file

@ -561,6 +561,8 @@ const message = {
custom: '自定义',
containerTerminal: '终端',
emptyUser: '为空时将使用容器默认的用户登录',
privileged: '特权模式',
privilegedHelper: '允许容器在主机上执行某些特权操作可能会增加容器风险谨慎开启',
upgradeHelper: '该操作仅支持容器版本升级',
ignoreCompare: '强制升级',

View file

@ -184,6 +184,12 @@
{{ $t('container.autoRemove') }}
</el-checkbox>
</el-form-item>
<el-form-item :label="$t('container.privileged')">
<el-checkbox v-model="dialogData.rowData!.privileged">
{{ $t('commons.button.start') }}
</el-checkbox>
<span class="input-help">{{ $t('container.privilegedHelper') }}</span>
</el-form-item>
<el-form-item :label="$t('container.console')">
<el-checkbox v-model="dialogData.rowData!.tty">{{ $t('container.tty') }}</el-checkbox>
<el-checkbox v-model="dialogData.rowData!.openStdin">