|
|
@@ -1,7 +1,7 @@
|
|
|
package cn.reghao.autodop.dagent.app.status;
|
|
|
|
|
|
import cn.reghao.autodop.common.deploy.AppStatus;
|
|
|
-import cn.reghao.autodop.common.dockerc.DockerClient;
|
|
|
+import cn.reghao.autodop.common.dockerc.Docker;
|
|
|
import cn.reghao.autodop.common.dockerc.exception.DockerException;
|
|
|
import cn.reghao.autodop.common.dockerc.pojo.ContainerInspect;
|
|
|
import cn.reghao.autodop.common.dockerc.pojo.State;
|
|
|
@@ -21,7 +21,7 @@ public class DockerAppStatusServiceImpl implements AppStatusService {
|
|
|
|
|
|
@Override
|
|
|
public void start(String appId) throws DockerException {
|
|
|
- try (DockerClient docker = new DockerClient()) {
|
|
|
+ try (Docker docker = new Docker()) {
|
|
|
String containerId = docker.getIdByName(appId);
|
|
|
docker.start(containerId);
|
|
|
}
|
|
|
@@ -29,7 +29,7 @@ public class DockerAppStatusServiceImpl implements AppStatusService {
|
|
|
|
|
|
@Override
|
|
|
public void stop(String appId) throws DockerException {
|
|
|
- try (DockerClient docker = new DockerClient()) {
|
|
|
+ try (Docker docker = new Docker()) {
|
|
|
String containerId = docker.getIdByName(appId);
|
|
|
docker.stop(containerId);
|
|
|
}
|
|
|
@@ -37,7 +37,7 @@ public class DockerAppStatusServiceImpl implements AppStatusService {
|
|
|
|
|
|
@Override
|
|
|
public void restart(String appId) throws DockerException {
|
|
|
- try (DockerClient docker = new DockerClient()) {
|
|
|
+ try (Docker docker = new Docker()) {
|
|
|
String containerId = docker.getIdByName(appId);
|
|
|
docker.restart(containerId);
|
|
|
}
|
|
|
@@ -45,7 +45,7 @@ public class DockerAppStatusServiceImpl implements AppStatusService {
|
|
|
|
|
|
@Override
|
|
|
public AppStatus status(String appId) throws DockerException {
|
|
|
- try (DockerClient docker = new DockerClient()) {
|
|
|
+ try (Docker docker = new Docker()) {
|
|
|
String containerId = docker.getIdByName(appId);
|
|
|
ContainerInspect container = docker.inspectContainer(containerId);
|
|
|
State state = container.getState();
|