diff --git a/src/test/java/com/emc/mongoose/util/docker/ContainerBase.java b/src/test/java/com/emc/mongoose/util/docker/ContainerBase.java index f6d0a4b48c..15cc51bdbc 100755 --- a/src/test/java/com/emc/mongoose/util/docker/ContainerBase.java +++ b/src/test/java/com/emc/mongoose/util/docker/ContainerBase.java @@ -11,6 +11,7 @@ import com.github.dockerjava.api.model.Bind; import com.github.dockerjava.api.model.ExposedPort; import com.github.dockerjava.api.model.Frame; +import com.github.dockerjava.api.model.HostConfig; import com.github.dockerjava.api.model.Volume; import com.github.dockerjava.core.DockerClientBuilder; import com.github.dockerjava.core.command.PullImageResultCallback; @@ -128,9 +129,7 @@ private String createContainer() { final CreateContainerCmd createContainerCmd = Docker.CLIENT .createContainerCmd(imageNameWithVer) .withName(imageName().replace('/', '_') + '_' + this.hashCode()) - .withNetworkMode("host") .withExposedPorts(exposedPorts) - .withMemory(memoryLimit) .withCmd(args); if(env != null && !env.isEmpty()) { createContainerCmd.withEnv(env); @@ -140,6 +139,9 @@ private String createContainer() { .withAttachStdout(attachOutputFlag) .withAttachStderr(attachOutputFlag); } + final HostConfig hostConfig = HostConfig.newHostConfig() + .withNetworkMode("host") + .withMemory(memoryLimit); if(volumeBinds != null && !volumeBinds.isEmpty()) { final List volumes = new ArrayList<>(volumeBinds.size()); final List binds = new ArrayList<>(volumeBinds.size()); @@ -152,8 +154,9 @@ private String createContainer() { } ); createContainerCmd.withVolumes(volumes); - createContainerCmd.withBinds(binds); + hostConfig.withBinds(binds); } + createContainerCmd.withHostConfig(hostConfig); final String entrypoint = entrypoint(); if(entrypoint != null && !entrypoint.isEmpty()) { createContainerCmd.withEntrypoint(entrypoint);