diff --git a/common/global.d.ts b/common/global.d.ts
index 88344fa2..e01513c6 100644
--- a/common/global.d.ts
+++ b/common/global.d.ts
@@ -71,6 +71,7 @@ export interface IGlobalInstanceDockerConfig {
networkAliases?: string[];
cpusetCpus?: string;
cpuUsage?: number;
+ workingDir?: string;
}
export interface IPanelResponseProtocol {
diff --git a/daemon/src/entity/commands/docker/docker_start.ts b/daemon/src/entity/commands/docker/docker_start.ts
index a46517dd..9d074a09 100755
--- a/daemon/src/entity/commands/docker/docker_start.ts
+++ b/daemon/src/entity/commands/docker/docker_start.ts
@@ -137,23 +137,12 @@ export default class DockerStartCommand extends InstanceCommand {
// resolve extra path mounts
const extraVolumes = instance.config.docker.extraVolumes;
const extraBinds = [];
- for (const it of extraVolumes) {
- if (!it) continue;
- const element = it.split(":");
- if (element.length < 2) continue;
- let hostPath = element[0];
- let containerPath = element.slice(1).join(":");
-
- if (path.isAbsolute(containerPath)) {
- containerPath = path.normalize(containerPath);
- } else {
- containerPath = path.normalize(path.join("/workspace/", containerPath));
- }
- if (path.isAbsolute(hostPath)) {
- hostPath = path.normalize(hostPath);
- } else {
- hostPath = path.normalize(path.join(process.cwd(), hostPath));
- }
+ for (const item of extraVolumes) {
+ if (!item) continue;
+ const paths = item.split(":");
+ if (paths.length < 2) continue;
+ const hostPath = path.normalize(paths[0]);
+ const containerPath = path.normalize(paths.slice(1).join(":"));
extraBinds.push(`${hostPath}:${containerPath}`);
}
diff --git a/daemon/src/entity/instance/Instance_config.ts b/daemon/src/entity/instance/Instance_config.ts
index 0e265965..bfdc4520 100755
--- a/daemon/src/entity/instance/Instance_config.ts
+++ b/daemon/src/entity/instance/Instance_config.ts
@@ -1,7 +1,6 @@
import Instance from "./instance";
-import { IDockerConfig } from "./interface";
import os from "os";
-import { IGlobalInstanceConfig } from "../../../../common/global";
+import { IGlobalInstanceConfig, IGlobalInstanceDockerConfig } from "common/global";
interface IActionCommand {
name: string;
command: string;
@@ -52,7 +51,7 @@ export default class InstanceConfig implements IGlobalInstanceConfig {
};
// Extend
- public docker: IDockerConfig = {
+ public docker: IGlobalInstanceDockerConfig = {
containerName: "",
image: "",
ports: [],
diff --git a/daemon/src/entity/instance/interface.ts b/daemon/src/entity/instance/interface.ts
index c801bd9b..483a2ec2 100755
--- a/daemon/src/entity/instance/interface.ts
+++ b/daemon/src/entity/instance/interface.ts
@@ -1,22 +1,5 @@
import { EventEmitter } from "events";
-// interface of docker config
-export interface IDockerConfig {
- containerName: string;
- image: string;
- memory: number; // Memory limit in bytes.
- ports: string[];
- extraVolumes: string[];
- maxSpace: number;
- network: number;
- io: number;
- networkMode: string;
- networkAliases: string[];
- cpusetCpus: string; // CPU allowed to execute (eg 0-3, , 0, 1)
- cpuUsage: number;
- workingDir: string;
-}
-
// Instance specific process interface
export interface IInstanceProcess extends EventEmitter {
pid?: number | string;
diff --git a/frontend/src/widgets/instance/dialogs/InstanceDetail.vue b/frontend/src/widgets/instance/dialogs/InstanceDetail.vue
index 825086da..f8ff28f1 100644
--- a/frontend/src/widgets/instance/dialogs/InstanceDetail.vue
+++ b/frontend/src/widgets/instance/dialogs/InstanceDetail.vue
@@ -394,6 +394,21 @@ defineExpose({
+
+
+ {{ t("容器工作目录挂载") }}
+
+
+ {{
+ t(
+ "实例工作目录中的所有文件将会挂载到容器内部的此目录中,不填写则默认 /workspace/"
+ )
+ }}
+
+
+
+
+
{{ t("TXT_CODE_cf88c936") }}
diff --git a/languages/en_US.json b/languages/en_US.json
index 8a5b5bcb..9fecca6f 100644
--- a/languages/en_US.json
+++ b/languages/en_US.json
@@ -1207,7 +1207,7 @@
"TXT_CODE_9278b7b0": "If engaged in commercial activities, consider using container to protect the host.",
"TXT_CODE_5be6c38e": "Default Type",
"TXT_CODE_6c87dd18": "Virtualization Container (Linux Docker)",
- "TXT_CODE_6904cb3": "Environment Image",
+ "TXT_CODE_6904cb3": "Docker Image",
"TXT_CODE_a584cb71": "Specify the instance image.",
"TXT_CODE_cf88c936": "Open Ports",
"TXT_CODE_3e68ca00": "Additional Mount points",
diff --git a/languages/zh_CN.json b/languages/zh_CN.json
index 4539a3e4..d1aaea57 100644
--- a/languages/zh_CN.json
+++ b/languages/zh_CN.json
@@ -1208,7 +1208,7 @@
"TXT_CODE_9278b7b0": "通常默认即可,如果从事商业活动则应当使用虚拟化容器启动方式,否则主机将可能被入侵。",
"TXT_CODE_5be6c38e": "默认类型",
"TXT_CODE_6c87dd18": "虚拟化容器(Linux Docker)",
- "TXT_CODE_6904cb3": "环境镜像",
+ "TXT_CODE_6904cb3": "Docker 镜像",
"TXT_CODE_a584cb71": "指定实例镜像",
"TXT_CODE_cf88c936": "开放端口",
"TXT_CODE_3e68ca00": "额外挂载路径",