openvidu-server: make autoremove a variable in DockerManager

pull/780/head
pabloFuente 2023-02-14 17:41:44 +01:00
parent 4d2fa546cf
commit 2e940b3af7
4 changed files with 8 additions and 5 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,
binds, "host", envs, null, properties.shmSize(), false, null, true,
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,
binds, "host", envs, null, properties.shmSize(), false, null, true,
openviduConfig.isOpenviduRecordingGPUEnabled());
} catch (Exception e) {
this.cleanRecordingMaps(recording);

View File

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

View File

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