openvidu-server: rollback autoremove property on runContainer

pull/780/head
pabloFuente 2023-02-16 17:05:15 +01:00
parent bd23cfcd71
commit 5a1bc4f7c3
5 changed files with 11 additions and 11 deletions

View File

@ -228,7 +228,7 @@ public class ComposedQuickStartRecordingService extends ComposedRecordingService
List<Bind> binds = new ArrayList<>();
binds.add(bind1);
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());
this.sessionsContainers.put(session.getSessionId(), containerId);
} catch (Exception e) {

View File

@ -164,7 +164,7 @@ public class ComposedRecordingService extends RecordingService {
List<Bind> binds = new ArrayList<>();
binds.add(bind1);
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());
} catch (Exception e) {
this.cleanRecordingMaps(recording);

View File

@ -22,6 +22,7 @@ import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import com.github.dockerjava.api.async.ResultCallback;
import com.github.dockerjava.api.exception.NotFoundException;
import com.github.dockerjava.api.model.WaitResponse;
public class WaitForContainerStoppedCallback implements ResultCallback<WaitResponse> {
@ -34,7 +35,6 @@ public class WaitForContainerStoppedCallback implements ResultCallback<WaitRespo
@Override
public void close() throws IOException {
// TODO Auto-generated method stub
}
@Override
@ -44,17 +44,19 @@ public class WaitForContainerStoppedCallback implements ResultCallback<WaitRespo
@Override
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
public void onStart(Closeable arg0) {
// TODO Auto-generated method stub
}
@Override
public void onNext(WaitResponse arg0) {
// TODO Auto-generated method stub
}
}

View File

@ -13,7 +13,7 @@ public interface DockerManager {
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,
Long shmSize, boolean privileged, Map<String, String> labels, boolean autoremove, boolean enableGPU)
Long shmSize, boolean privileged, Map<String, String> labels, boolean enableGPU)
throws Exception;
public void removeContainer(String mediaNodeId, String containerId, boolean force);

View File

@ -127,8 +127,7 @@ public class LocalDockerManager implements DockerManager {
@Override
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,
Long shmSize, boolean privileged, Map<String, String> labels, boolean autoremove, boolean enableGPU)
throws Exception {
Long shmSize, boolean privileged, Map<String, String> labels, boolean enableGPU) throws Exception {
CreateContainerCmd cmd = dockerClient.createContainerCmd(image).withEnv(envs);
if (containerName != null) {
@ -139,8 +138,7 @@ public class LocalDockerManager implements DockerManager {
cmd.withUser(user);
}
HostConfig hostConfig = new HostConfig().withNetworkMode(networkMode).withPrivileged(privileged)
.withAutoRemove(autoremove);
HostConfig hostConfig = new HostConfig().withNetworkMode(networkMode).withPrivileged(privileged);
if (shmSize != null) {
hostConfig.withShmSize(shmSize);
}