mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: rollback autoremove property on runContainer
parent
bd23cfcd71
commit
5a1bc4f7c3
|
@ -228,7 +228,7 @@ public class ComposedQuickStartRecordingService extends ComposedRecordingService
|
||||||
List<Bind> binds = new ArrayList<>();
|
List<Bind> binds = new ArrayList<>();
|
||||||
binds.add(bind1);
|
binds.add(bind1);
|
||||||
containerId = dockerManager.runContainer(properties.mediaNode(), container, containerName, null, volumes,
|
containerId = dockerManager.runContainer(properties.mediaNode(), container, containerName, null, volumes,
|
||||||
binds, "host", envs, null, properties.shmSize(), false, null, true,
|
binds, "host", envs, null, properties.shmSize(), false, null,
|
||||||
openviduConfig.isOpenviduRecordingGPUEnabled());
|
openviduConfig.isOpenviduRecordingGPUEnabled());
|
||||||
this.sessionsContainers.put(session.getSessionId(), containerId);
|
this.sessionsContainers.put(session.getSessionId(), containerId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -164,7 +164,7 @@ public class ComposedRecordingService extends RecordingService {
|
||||||
List<Bind> binds = new ArrayList<>();
|
List<Bind> binds = new ArrayList<>();
|
||||||
binds.add(bind1);
|
binds.add(bind1);
|
||||||
containerId = dockerManager.runContainer(properties.mediaNode(), container, containerName, null, volumes,
|
containerId = dockerManager.runContainer(properties.mediaNode(), container, containerName, null, volumes,
|
||||||
binds, "host", envs, null, properties.shmSize(), false, null, true,
|
binds, "host", envs, null, properties.shmSize(), false, null,
|
||||||
openviduConfig.isOpenviduRecordingGPUEnabled());
|
openviduConfig.isOpenviduRecordingGPUEnabled());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.cleanRecordingMaps(recording);
|
this.cleanRecordingMaps(recording);
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.io.IOException;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
|
||||||
import com.github.dockerjava.api.async.ResultCallback;
|
import com.github.dockerjava.api.async.ResultCallback;
|
||||||
|
import com.github.dockerjava.api.exception.NotFoundException;
|
||||||
import com.github.dockerjava.api.model.WaitResponse;
|
import com.github.dockerjava.api.model.WaitResponse;
|
||||||
|
|
||||||
public class WaitForContainerStoppedCallback implements ResultCallback<WaitResponse> {
|
public class WaitForContainerStoppedCallback implements ResultCallback<WaitResponse> {
|
||||||
|
@ -34,7 +35,6 @@ public class WaitForContainerStoppedCallback implements ResultCallback<WaitRespo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,17 +44,19 @@ public class WaitForContainerStoppedCallback implements ResultCallback<WaitRespo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable arg0) {
|
public void onError(Throwable arg0) {
|
||||||
// TODO Auto-generated method stub
|
if (arg0 instanceof NotFoundException) {
|
||||||
|
// The container cannot be found
|
||||||
|
System.err.println("Waiting for container stopped but it did not exist: " + arg0.getMessage());
|
||||||
|
latch.countDown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart(Closeable arg0) {
|
public void onStart(Closeable arg0) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(WaitResponse arg0) {
|
public void onNext(WaitResponse arg0) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ public interface DockerManager {
|
||||||
|
|
||||||
public String runContainer(String mediaNodeId, String image, String containerName, String user,
|
public String runContainer(String mediaNodeId, String image, String containerName, String user,
|
||||||
List<Volume> volumes, List<Bind> binds, String networkMode, List<String> envs, List<String> command,
|
List<Volume> volumes, List<Bind> binds, String networkMode, List<String> envs, List<String> command,
|
||||||
Long shmSize, boolean privileged, Map<String, String> labels, boolean autoremove, boolean enableGPU)
|
Long shmSize, boolean privileged, Map<String, String> labels, boolean enableGPU)
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
|
||||||
public void removeContainer(String mediaNodeId, String containerId, boolean force);
|
public void removeContainer(String mediaNodeId, String containerId, boolean force);
|
||||||
|
|
|
@ -127,8 +127,7 @@ public class LocalDockerManager implements DockerManager {
|
||||||
@Override
|
@Override
|
||||||
public String runContainer(String mediaNodeId, String image, String containerName, String user,
|
public String runContainer(String mediaNodeId, String image, String containerName, String user,
|
||||||
List<Volume> volumes, List<Bind> binds, String networkMode, List<String> envs, List<String> command,
|
List<Volume> volumes, List<Bind> binds, String networkMode, List<String> envs, List<String> command,
|
||||||
Long shmSize, boolean privileged, Map<String, String> labels, boolean autoremove, boolean enableGPU)
|
Long shmSize, boolean privileged, Map<String, String> labels, boolean enableGPU) throws Exception {
|
||||||
throws Exception {
|
|
||||||
|
|
||||||
CreateContainerCmd cmd = dockerClient.createContainerCmd(image).withEnv(envs);
|
CreateContainerCmd cmd = dockerClient.createContainerCmd(image).withEnv(envs);
|
||||||
if (containerName != null) {
|
if (containerName != null) {
|
||||||
|
@ -139,8 +138,7 @@ public class LocalDockerManager implements DockerManager {
|
||||||
cmd.withUser(user);
|
cmd.withUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
HostConfig hostConfig = new HostConfig().withNetworkMode(networkMode).withPrivileged(privileged)
|
HostConfig hostConfig = new HostConfig().withNetworkMode(networkMode).withPrivileged(privileged);
|
||||||
.withAutoRemove(autoremove);
|
|
||||||
if (shmSize != null) {
|
if (shmSize != null) {
|
||||||
hostConfig.withShmSize(shmSize);
|
hostConfig.withShmSize(shmSize);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue