Repository: docker-java/docker-java
Pull request #275 (2015-07-17 20:49:58)

Fix for #218
6 failures running integration tests locally but they do not appear to be related to this change. All look to be coming from commands being run inside containers and returning non-zero exit codes.


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 134b8d8c..34313506 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,7 +3,7 @@ Change Log
 
 Latest SNAPSHOT
 ---
-* [#272](https://github.com/docker-java/docker-java/pull/272) remove withHostConfig() from create container command
+
 * [#270](https://github.com/docker-java/docker-java/pull/270) Passing result callbacks for async commands via commands exec()
 * [#269](https://github.com/docker-java/docker-java/pull/269) Add filters option to events operation 
 * [#268](https://github.com/docker-java/docker-java/pull/268) Concurrent DockerCmdExecFactory.getDefaultDockerCmdExecFactory fails on reload
diff --git a/src/main/java/com/github/dockerjava/api/command/CreateContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/CreateContainerCmd.java
index ab4ac9fe..4623167d 100644
--- a/src/main/java/com/github/dockerjava/api/command/CreateContainerCmd.java
+++ b/src/main/java/com/github/dockerjava/api/command/CreateContainerCmd.java
@@ -8,12 +8,13 @@ import com.github.dockerjava.api.model.Bind;
 import com.github.dockerjava.api.model.Capability;
 import com.github.dockerjava.api.model.Device;
 import com.github.dockerjava.api.model.ExposedPort;
+import com.github.dockerjava.api.model.HostConfig;
 import com.github.dockerjava.api.model.Link;
+import com.github.dockerjava.api.model.LogConfig;
 import com.github.dockerjava.api.model.LxcConf;
 import com.github.dockerjava.api.model.PortBinding;
 import com.github.dockerjava.api.model.Ports;
 import com.github.dockerjava.api.model.RestartPolicy;
-import com.github.dockerjava.api.model.Ulimit;
 import com.github.dockerjava.api.model.Volume;
 import com.github.dockerjava.api.model.VolumesFrom;
 
@@ -77,6 +78,8 @@ public interface CreateContainerCmd extends SyncDockerCmd<CreateContainerRespons
 
     public String[] getExtraHosts();
 
+    public HostConfig getHostConfig();
+
     public String getHostName();
 
     public String getDomainName();
@@ -86,6 +89,8 @@ public interface CreateContainerCmd extends SyncDockerCmd<CreateContainerRespons
     public Link[] getLinks();
 
     public LxcConf[] getLxcConf();
+    
+    public LogConfig getLogConfig();
 
     public String getMacAddress();
 
@@ -111,8 +116,6 @@ public interface CreateContainerCmd extends SyncDockerCmd<CreateContainerRespons
 
     public String getWorkingDir();
 
-    public Ulimit[] getUlimits();
-
     public boolean isAttachStderr();
 
     public boolean isAttachStdin();
@@ -207,6 +210,8 @@ public interface CreateContainerCmd extends SyncDockerCmd<CreateContainerRespons
      */
     public CreateContainerCmd withExtraHosts(String... extraHosts);
 
+    public CreateContainerCmd withHostConfig(HostConfig hostConfig);
+
     public CreateContainerCmd withHostName(String hostName);
 
     public CreateContainerCmd withDomainName(String domainName);
@@ -222,6 +227,8 @@ public interface CreateContainerCmd extends SyncDockerCmd<CreateContainerRespons
 
     public CreateContainerCmd withLxcConf(LxcConf... lxcConf);
 
+    public CreateContainerCmd withLogConfig(LogConfig logConfig);
+
     public CreateContainerCmd withMemoryLimit(long memoryLimit);
 
     public CreateContainerCmd withMemorySwap(long memorySwap);
@@ -280,12 +287,6 @@ public interface CreateContainerCmd extends SyncDockerCmd<CreateContainerRespons
 
     public CreateContainerCmd withMacAddress(String macAddress);
 
-    public CreateContainerCmd withUlimits(Ulimit[] ulimits);
-
-    public CreateContainerCmd withReadonlyRootfs(boolean readonlyRootfs);
-
-    public CreateContainerCmd withContainerIDFile(String containerIDFile);
-
     /**
      * @return
      */
diff --git a/src/main/java/com/github/dockerjava/api/model/HostConfig.java b/src/main/java/com/github/dockerjava/api/model/HostConfig.java
index 8e228fbb..6bced839 100644
--- a/src/main/java/com/github/dockerjava/api/model/HostConfig.java
+++ b/src/main/java/com/github/dockerjava/api/model/HostConfig.java
@@ -17,6 +17,9 @@ public class HostConfig {
 
     @JsonProperty("LxcConf")
     private LxcConf[] lxcConf;
+    
+    @JsonProperty("LogConfig")
+    private LogConfig logConfig;
 
     @JsonProperty("PortBindings")
     private Ports portBindings;
@@ -66,13 +69,14 @@ public class HostConfig {
     public HostConfig() {
     }
 
-    public HostConfig(Bind[] binds, Link[] links, LxcConf[] lxcConf, Ports portBindings, boolean publishAllPorts,
+    public HostConfig(Bind[] binds, Link[] links, LxcConf[] lxcConf, LogConfig logConfig, Ports portBindings, boolean publishAllPorts,
             boolean privileged, boolean readonlyRootfs, String[] dns, String[] dnsSearch, VolumesFrom[] volumesFrom,
             String containerIDFile, Capability[] capAdd, Capability[] capDrop, RestartPolicy restartPolicy,
             String networkMode, Device[] devices, String[] extraHosts, Ulimit[] ulimits) {
         this.binds = new Binds(binds);
         this.links = new Links(links);
         this.lxcConf = lxcConf;
+        this.logConfig = logConfig;
         this.portBindings = portBindings;
         this.publishAllPorts = publishAllPorts;
         this.privileged = privileged;
@@ -98,6 +102,11 @@ public class HostConfig {
     public LxcConf[] getLxcConf() {
         return lxcConf;
     }
+    
+    @JsonIgnore
+    public LogConfig getLogConfig() {
+        return (logConfig == null) ? new LogConfig() : logConfig;
+    }
 
     public Ports getPortBindings() {
         return portBindings;
@@ -177,6 +186,11 @@ public class HostConfig {
     public void setLxcConf(LxcConf[] lxcConf) {
         this.lxcConf = lxcConf;
     }
+    
+    @JsonIgnore
+    public void setLogConfig(LogConfig logConfig) {
+        this.logConfig = logConfig;
+    }
 
     public void setPortBindings(Ports portBindings) {
         this.portBindings = portBindings;
diff --git a/src/main/java/com/github/dockerjava/api/model/LogConfig.java b/src/main/java/com/github/dockerjava/api/model/LogConfig.java
new file mode 100644
index 00000000..931d9cff
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/model/LogConfig.java
@@ -0,0 +1,59 @@
+package com.github.dockerjava.api.model;
+
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Log driver to use for a created/running container. The
+ * available types are:
+ * 
+ *     json-file (default)
+ *     syslog
+ *     journald
+ *     none
+ *
+ * If a driver is specified that is NOT supported,docker
+ * will default to null. If configs are supplied that are
+ * not supported by the type docker will ignore them. In most 
+ * cases setting the config option to null will suffice. Consult 
+ * the docker remote API for a more detailed and up-to-date 
+ * explanation of the available types and their options.
+ */
+public class LogConfig {
+    
+    @JsonProperty("Type")
+    public String type;
+    
+    @JsonProperty("Config")
+    public Map<String, String> config;
+
+    public LogConfig(String type, Map<String, String> config) {
+        this.type = type;
+        this.config = config;
+    }
+
+    public LogConfig() {
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public LogConfig setType(String type) {
+        this.type = type;
+        return this;
+    }
+
+    @JsonIgnore
+    public Map<String, String> getConfig() {
+    	return config;
+    }
+    
+    @JsonIgnore
+    public LogConfig setConfig(Map<String, String> config) {
+    	this.config = config;
+    	return this;
+    }
+}
diff --git a/src/main/java/com/github/dockerjava/core/command/CreateContainerCmdImpl.java b/src/main/java/com/github/dockerjava/core/command/CreateContainerCmdImpl.java
index 11fb50b5..70177b57 100644
--- a/src/main/java/com/github/dockerjava/core/command/CreateContainerCmdImpl.java
+++ b/src/main/java/com/github/dockerjava/core/command/CreateContainerCmdImpl.java
@@ -19,11 +19,11 @@ import com.github.dockerjava.api.model.ExposedPort;
 import com.github.dockerjava.api.model.ExposedPorts;
 import com.github.dockerjava.api.model.HostConfig;
 import com.github.dockerjava.api.model.Link;
+import com.github.dockerjava.api.model.LogConfig;
 import com.github.dockerjava.api.model.LxcConf;
 import com.github.dockerjava.api.model.PortBinding;
 import com.github.dockerjava.api.model.Ports;
 import com.github.dockerjava.api.model.RestartPolicy;
-import com.github.dockerjava.api.model.Ulimit;
 import com.github.dockerjava.api.model.Volume;
 import com.github.dockerjava.api.model.Volumes;
 import com.github.dockerjava.api.model.VolumesFrom;
@@ -148,11 +148,6 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
         return hostConfig.getBinds();
     }
 
-    @Override
-    public Integer getBlkioWeight() {
-        return blkioWeight;
-    }
-
     @Override
     public Capability[] getCapAdd() {
         return hostConfig.getCapAdd();
@@ -168,18 +163,19 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
         return cmd;
     }
 
-    public String getContainerIDFile() {
-        return hostConfig.getContainerIDFile();
+    @Override
+    public String getCpuset() {
+        return cpuset;
     }
 
     @Override
-    public Integer getCpuPeriod() {
-        return cpuPeriod;
+    public int getCpuShares() {
+        return cpuShares;
     }
 
     @Override
-    public String getCpuset() {
-        return cpuset;
+    public Integer getCpuPeriod() {
+        return cpuPeriod;
     }
 
     @Override
@@ -188,8 +184,13 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
     }
 
     @Override
-    public int getCpuShares() {
-        return cpuShares;
+    public Integer getBlkioWeight() {
+        return blkioWeight;
+    }
+
+    @Override
+    public Boolean isOomKillDisable() {
+        return oomKillDisable;
     }
 
     @Override
@@ -210,11 +211,6 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
         return hostConfig.getDnsSearch();
     }
 
-    @Override
-    public String getDomainName() {
-        return domainName;
-    }
-
     @Override
     public String[] getEntrypoint() {
         return entrypoint;
@@ -237,11 +233,21 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
         return hostConfig.getExtraHosts();
     }
 
+    @Override
+    public HostConfig getHostConfig() {
+        return hostConfig;
+    }
+
     @Override
     public String getHostName() {
         return hostName;
     }
 
+    @Override
+    public String getDomainName() {
+        return domainName;
+    }
+
     @Override
     public String getImage() {
         return image;
@@ -249,14 +255,14 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
 
     @Override
     @JsonIgnore
-    public Map<String, String> getLabels() {
-        return labels;
+    public Link[] getLinks() {
+        return hostConfig.getLinks();
     }
 
     @Override
     @JsonIgnore
-    public Link[] getLinks() {
-        return hostConfig.getLinks();
+    public Map<String, String> getLabels() {
+        return labels;
     }
 
     @Override
@@ -264,6 +270,12 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
     public LxcConf[] getLxcConf() {
         return hostConfig.getLxcConf();
     }
+    
+    @Override
+    @JsonIgnore
+    public LogConfig getLogConfig() {
+        return hostConfig.getLogConfig();
+    }
 
     public String getMacAddress() {
         return macAddress;
@@ -307,11 +319,6 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
         return hostConfig.getRestartPolicy();
     }
 
-    @Override
-    public Ulimit[] getUlimits() {
-        return hostConfig.getUlimits();
-    }
-
     @Override
     public String getUser() {
         return user;
@@ -354,11 +361,6 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
         return networkDisabled;
     }
 
-    @Override
-    public Boolean isOomKillDisable() {
-        return oomKillDisable;
-    }
-
     @Override
     @JsonIgnore
     public Boolean isPrivileged() {
@@ -371,10 +373,6 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
         return hostConfig.isPublishAllPorts();
     }
 
-    public boolean isReadonlyRootfs() {
-        return hostConfig.isReadonlyRootfs();
-    }
-
     @Override
     public boolean isStdInOnce() {
         return stdInOnce;
@@ -416,139 +414,133 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
 
     @Override
     public CreateContainerCmd withBinds(Bind... binds) {
-        checkNotNull(binds, "binds was not specified");
         hostConfig.setBinds(binds);
         return this;
     }
 
-    @Override
-    public CreateContainerCmd withBlkioWeight(Integer blkioWeight) {
-        checkNotNull(blkioWeight, "blkioWeight was not specified");
-        this.blkioWeight = blkioWeight;
-        return null;
-    }
-
     @Override
     public CreateContainerCmd withCapAdd(Capability... capAdd) {
-        checkNotNull(capAdd, "capAdd was not specified");
         hostConfig.setCapAdd(capAdd);
         return this;
     }
 
     @Override
     public CreateContainerCmd withCapDrop(Capability... capDrop) {
-        checkNotNull(capDrop, "capDrop was not specified");
         hostConfig.setCapDrop(capDrop);
         return this;
     }
 
     @Override
     public CreateContainerCmdImpl withCmd(String... cmd) {
-        checkNotNull(cmd, "cmd was not specified");
         this.cmd = cmd;
         return this;
     }
 
     @Override
-    public CreateContainerCmd withContainerIDFile(String containerIDFile) {
-        checkNotNull(containerIDFile, "no containerIDFile was specified");
-        hostConfig.setContainerIDFile(containerIDFile);
+    public CreateContainerCmdImpl withCpuset(String cpuset) {
+        this.cpuset = cpuset;
         return this;
     }
 
     @Override
-    public CreateContainerCmd withCpuPeriod(Integer cpuPeriod) {
-        checkNotNull(cpuPeriod, "cpuPeriod was not specified");
-        this.cpuPeriod = cpuPeriod;
+    public CreateContainerCmdImpl withCpuShares(int cpuShares) {
+        this.cpuShares = cpuShares;
         return this;
     }
 
     @Override
-    public CreateContainerCmdImpl withCpuset(String cpuset) {
-        checkNotNull(cpuset, "cpuset was not specified");
-        this.cpuset = cpuset;
+    public CreateContainerCmd withCpuPeriod(Integer cpuPeriod) {
+        this.cpuPeriod = cpuPeriod;
         return this;
     }
 
     @Override
     public CreateContainerCmd withCpusetMems(String cpusetMems) {
-        checkNotNull(cpusetMems, "cpusetMems was not specified");
         this.cpusetMems = cpusetMems;
         return null;
     }
 
     @Override
-    public CreateContainerCmdImpl withCpuShares(int cpuShares) {
-        this.cpuShares = cpuShares;
-        return this;
+    public CreateContainerCmd withBlkioWeight(Integer blkioWeight) {
+        this.blkioWeight = blkioWeight;
+        return null;
+    }
+
+    @Override
+    public CreateContainerCmd withOomKillDisable(Boolean oomKillDisable) {
+        this.oomKillDisable = oomKillDisable;
+        return null;
     }
 
     @Override
     public CreateContainerCmd withDevices(Device... devices) {
-        checkNotNull(devices, "devices was not specified");
         this.hostConfig.setDevices(devices);
         return this;
     }
 
     @Override
-    public CreateContainerCmdImpl withDns(String... dns) {
-        checkNotNull(dns, "dns was not specified");
-        this.hostConfig.setDns(dns);
+    public CreateContainerCmdImpl withNetworkDisabled(boolean disableNetwork) {
+        this.networkDisabled = disableNetwork;
         return this;
     }
 
     @Override
-    public CreateContainerCmd withDnsSearch(String... dnsSearch) {
-        checkNotNull(dnsSearch, "dnsSearch was not specified");
-        this.hostConfig.setDnsSearch(dnsSearch);
+    public CreateContainerCmdImpl withDns(String... dns) {
+        this.hostConfig.setDns(dns);
         return this;
     }
 
     @Override
-    public CreateContainerCmdImpl withDomainName(String domainName) {
-        checkNotNull(domainName, "no domainName was specified");
-        this.domainName = domainName;
+    public CreateContainerCmd withDnsSearch(String... dnsSearch) {
+        this.hostConfig.setDnsSearch(dnsSearch);
         return this;
     }
 
     @Override
     public CreateContainerCmdImpl withEntrypoint(String... entrypoint) {
-        checkNotNull(entrypoint, "entrypoint was not specified");
         this.entrypoint = entrypoint;
         return this;
     }
 
     @Override
     public CreateContainerCmdImpl withEnv(String... env) {
-        checkNotNull(env, "env was not specified");
         this.env = env;
         return this;
     }
 
     @Override
     public CreateContainerCmdImpl withExposedPorts(ExposedPort... exposedPorts) {
-        checkNotNull(exposedPorts, "exposedPorts was not specified");
         this.exposedPorts = new ExposedPorts(exposedPorts);
         return this;
     }
 
     @Override
     public CreateContainerCmd withExtraHosts(String... extraHosts) {
-        checkNotNull(extraHosts, "extraHosts was not specified");
         this.hostConfig.setExtraHosts(extraHosts);
         return this;
     }
 
+    @Override
+    public CreateContainerCmd withHostConfig(HostConfig hostConfig) {
+        checkNotNull(hostConfig, "no host config was specified");
+        this.hostConfig = hostConfig;
+        return this;
+    }
+
     @Override
     public CreateContainerCmdImpl withHostName(String hostName) {
-        checkNotNull(hostConfig, "no hostName was specified");
         this.hostName = hostName;
         return this;
     }
 
+    @Override
+    public CreateContainerCmdImpl withDomainName(String domainName) {
+        this.domainName = domainName;
+        return this;
+    }
+
     @Override
     public CreateContainerCmdImpl withImage(String image) {
-        checkNotNull(image, "no image was specified");
         this.image = image;
         return this;
     }
@@ -573,10 +565,16 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
         this.hostConfig.setLxcConf(lxcConf);
         return this;
     }
+    
+    @Override
+    public CreateContainerCmd withLogConfig(LogConfig logConfig) {
+        checkNotNull(logConfig, "logConfig was not specified");
+        this.hostConfig.setLogConfig(logConfig);
+        return this;
+    }
 
     @Override
     public CreateContainerCmdImpl withMacAddress(String macAddress) {
-        checkNotNull(macAddress, "macAddress was not specified");
         this.macAddress = macAddress;
         return this;
     }
@@ -600,12 +598,6 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
         return this;
     }
 
-    @Override
-    public CreateContainerCmdImpl withNetworkDisabled(boolean disableNetwork) {
-        this.networkDisabled = disableNetwork;
-        return this;
-    }
-
     @Override
     public CreateContainerCmd withNetworkMode(String networkMode) {
         checkNotNull(networkMode, "networkMode was not specified");
@@ -613,13 +605,6 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
         return this;
     }
 
-    @Override
-    public CreateContainerCmd withOomKillDisable(Boolean oomKillDisable) {
-        checkNotNull(oomKillDisable, "oomKillDisable was not specified");
-        this.oomKillDisable = oomKillDisable;
-        return null;
-    }
-
     @Override
     public CreateContainerCmd withPortBindings(PortBinding... portBindings) {
         checkNotNull(portBindings, "portBindings was not specified");
@@ -636,7 +621,6 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
 
     @Override
     public CreateContainerCmdImpl withPortSpecs(String... portSpecs) {
-        checkNotNull(portSpecs, "portSpecs was not specified");
         this.portSpecs = portSpecs;
         return this;
     }
@@ -653,15 +637,8 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
         return this;
     }
 
-    @Override
-    public CreateContainerCmd withReadonlyRootfs(boolean readonlyRootfs) {
-        hostConfig.setReadonlyRootfs(readonlyRootfs);
-        return this;
-    }
-
     @Override
     public CreateContainerCmd withRestartPolicy(RestartPolicy restartPolicy) {
-        checkNotNull(restartPolicy, "restartPolicy was not specified");
         this.hostConfig.setRestartPolicy(restartPolicy);
         return this;
     }
@@ -684,37 +661,26 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
         return this;
     }
 
-    @Override
-    public CreateContainerCmd withUlimits(Ulimit[] ulimits) {
-        checkNotNull(ulimits, "no ulimits was specified");
-        hostConfig.setUlimits(ulimits);
-        return this;
-    }
-
     @Override
     public CreateContainerCmdImpl withUser(String user) {
-        checkNotNull(user, "user was not specified");
         this.user = user;
         return this;
     }
 
     @Override
     public CreateContainerCmdImpl withVolumes(Volume... volumes) {
-        checkNotNull(volumes, "volumes was not specified");
         this.volumes = new Volumes(volumes);
         return this;
     }
 
     @Override
     public CreateContainerCmdImpl withVolumesFrom(VolumesFrom... volumesFrom) {
-        checkNotNull(volumesFrom, "volumesFrom was not specified");
         this.hostConfig.setVolumesFrom(volumesFrom);
         return this;
     }
 
     @Override
     public CreateContainerCmdImpl withWorkingDir(String workingDir) {
-        checkNotNull(workingDir, "workingDir was not specified");
         this.workingDir = workingDir;
         return this;
     }
diff --git a/src/main/java/com/github/dockerjava/jaxrs/DockerCmdExecFactoryImpl.java b/src/main/java/com/github/dockerjava/jaxrs/DockerCmdExecFactoryImpl.java
index cb08f8d8..f1f196a0 100644
--- a/src/main/java/com/github/dockerjava/jaxrs/DockerCmdExecFactoryImpl.java
+++ b/src/main/java/com/github/dockerjava/jaxrs/DockerCmdExecFactoryImpl.java
@@ -4,12 +4,14 @@ import static com.google.common.base.Preconditions.checkNotNull;
 
 import java.io.IOException;
 import java.net.URI;
+import java.util.concurrent.TimeUnit;
 
 import javax.net.ssl.SSLContext;
 import javax.ws.rs.client.Client;
 import javax.ws.rs.client.ClientBuilder;
 import javax.ws.rs.client.WebTarget;
 
+import org.apache.http.client.config.RequestConfig;
 import org.apache.http.config.RegistryBuilder;
 import org.apache.http.conn.socket.ConnectionSocketFactory;
 import org.apache.http.conn.socket.PlainConnectionSocketFactory;
@@ -118,7 +120,7 @@ public class DockerCmdExecFactoryImpl implements DockerCmdExecFactory {
         }
 
         PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(getSchemeRegistry(
-                originalUri, sslContext));
+                originalUri, sslContext), null, null, null, 10, TimeUnit.SECONDS);
 
         if (dockerClientConfig.getMaxTotalConnections() != null)
             connManager.setMaxTotal(dockerClientConfig.getMaxTotalConnections());
@@ -127,9 +129,8 @@ public class DockerCmdExecFactoryImpl implements DockerCmdExecFactory {
 
         clientConfig.property(ApacheClientProperties.CONNECTION_MANAGER, connManager);
 
-        // Configure connection pool timeout
-        // clientConfig.property(ApacheClientProperties.REQUEST_CONFIG, RequestConfig.custom()
-        // .setConnectionRequestTimeout(1000).build());
+        clientConfig.property(ApacheClientProperties.REQUEST_CONFIG, RequestConfig.custom()
+                .setConnectionRequestTimeout(1000).build());
 
         ClientBuilder clientBuilder = ClientBuilder.newBuilder().withConfig(clientConfig);
 


Test patch:
diff --git a/src/test/java/com/github/dockerjava/core/command/CreateContainerCmdImplTest.java b/src/test/java/com/github/dockerjava/core/command/CreateContainerCmdImplTest.java
index 9d682e24..eb5d1a3f 100644
--- a/src/test/java/com/github/dockerjava/core/command/CreateContainerCmdImplTest.java
+++ b/src/test/java/com/github/dockerjava/core/command/CreateContainerCmdImplTest.java
@@ -38,6 +38,7 @@ import com.github.dockerjava.api.model.Device;
 import com.github.dockerjava.api.model.ExposedPort;
 import com.github.dockerjava.api.model.HostConfig;
 import com.github.dockerjava.api.model.Link;
+import com.github.dockerjava.api.model.LogConfig;
 import com.github.dockerjava.api.model.Ports;
 import com.github.dockerjava.api.model.RestartPolicy;
 import com.github.dockerjava.api.model.Ulimit;
@@ -254,8 +255,10 @@ public class CreateContainerCmdImplTest extends AbstractDockerClientTest {
         LOG.info("Container1 Inspect: {}", inspectContainerResponse1.toString());
         assertThat(inspectContainerResponse1.getState().isRunning(), is(true));
 
+        HostConfig hostConfig = new HostConfig();
+        hostConfig.setLinks(new Link("container1", "container1Link"));
         CreateContainerResponse container2 = dockerClient.createContainerCmd("busybox").withName("container2")
-                .withCmd("env").withLinks(new Link("container1", "container1Link")).exec();
+                .withHostConfig(hostConfig).withCmd("env").exec();
         LOG.info("Created container {}", container2.toString());
         assertThat(container2.getId(), not(isEmptyString()));
 
@@ -322,8 +325,11 @@ public class CreateContainerCmdImplTest extends AbstractDockerClientTest {
 
         String[] extraHosts = { "dockerhost:127.0.0.1", "otherhost:10.0.0.1" };
 
+        HostConfig hostConfig = new HostConfig();
+        hostConfig.setExtraHosts(extraHosts);
+
         CreateContainerResponse container = dockerClient.createContainerCmd("busybox").withName("container")
-                .withExtraHosts(extraHosts).exec();
+                .withHostConfig(hostConfig).exec();
 
         LOG.info("Created container {}", container.toString());
 
@@ -492,8 +498,11 @@ public class CreateContainerCmdImplTest extends AbstractDockerClientTest {
 
         Ulimit[] ulimits = { new Ulimit("nproc", 709, 1026), new Ulimit("nofile", 1024, 4096) };
 
+        HostConfig hostConfig = new HostConfig();
+        hostConfig.setUlimits(ulimits);
+
         CreateContainerResponse container = dockerClient.createContainerCmd("busybox").withName("container")
-                .withUlimits(ulimits).exec();
+                .withHostConfig(hostConfig).exec();
 
         LOG.info("Created container {}", container.toString());
 
@@ -526,4 +535,21 @@ public class CreateContainerCmdImplTest extends AbstractDockerClientTest {
         labels.put("com.github.dockerjava.null", "");
         assertThat(inspectContainerResponse.getConfig().getLabels(), is(equalTo(labels)));
     }
+    
+    @Test(groups = "ignoreInCircleCi")
+    public void createContainerWithLogConfig() throws DockerException {
+
+    	LogConfig logConfig = new LogConfig("none", null);
+        CreateContainerResponse container = dockerClient.createContainerCmd("busybox").
+        		withLogConfig(logConfig).exec();
+
+        LOG.info("Created container {}", container.toString());
+
+        assertThat(container.getId(), not(isEmptyString()));
+
+        InspectContainerResponse inspectContainerResponse = dockerClient.inspectContainerCmd(container.getId()).exec();
+
+        // null becomes empty string
+        assertEquals(inspectContainerResponse.getHostConfig().getLogConfig().type, logConfig.type);
+    }
 }