|
@@ -171,8 +171,8 @@ public class DockerExe {
|
|
|
|
|
|
Mount wokerMount = new Mount()
|
|
|
.withType(MountType.BIND)
|
|
|
- .withSource("/cephfs/mdo/"+pid +"/")
|
|
|
- .withTarget("/workspace/")
|
|
|
+ .withSource("/cephfs/mdo/"+pid+"/")
|
|
|
+ .withTarget("/cephfs/mdo/"+pid+"/")
|
|
|
.withReadOnly(false);
|
|
|
List<Mount> am =new ArrayList<>();
|
|
|
am.add(wokerMount);
|
|
@@ -184,14 +184,15 @@ public class DockerExe {
|
|
|
.withHostConfig(
|
|
|
HostConfig.newHostConfig()
|
|
|
.withMounts(am)
|
|
|
- ).exec();
|
|
|
- dockerClient.startContainerCmd(container.getId()).exec();
|
|
|
- // 执行命令(你也可以在这里直接使用execStartCmd)
|
|
|
- ExecCreateCmdResponse execCreateCmdResponse = dockerClient.execCreateCmd(container.getId())
|
|
|
- .withCmd("bash", "-c", "source /home/mdo/aeroelastic.sh && cd /workspace && mpiexec -n 1 python run.py")
|
|
|
+ ).withCmd("bash", "-c", "source /home/mdo/aeroelastic.sh && cd /cephfs/mdo/"+pid+"/in && mpiexec -n 1 python run.py")
|
|
|
.exec();
|
|
|
- dockerClient.startContainerCmd(execCreateCmdResponse.getId()).exec();
|
|
|
+ dockerClient.startContainerCmd(container.getId()).exec();
|
|
|
System.out.println("容器启动成功,ID: " + container.getId());
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ stopDocker("6cb37eea2845457ca17ba6441804af43");
|
|
|
+ runMdo2("6cb37eea2845457ca17ba6441804af43");
|
|
|
+ }
|
|
|
}
|