mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: fix getContainerIp for Docker > 2.29
parent
0d728f71d0
commit
46050c40b4
|
|
@ -75,12 +75,12 @@ public class LocalDockerManager implements DockerManager {
|
||||||
public DockerManager init() {
|
public DockerManager init() {
|
||||||
DockerClientConfig dockerClientConfig = DefaultDockerClientConfig.createDefaultConfigBuilder().build();
|
DockerClientConfig dockerClientConfig = DefaultDockerClientConfig.createDefaultConfigBuilder().build();
|
||||||
DockerHttpClient dockerHttpClient = new ZerodepDockerHttpClient.Builder()
|
DockerHttpClient dockerHttpClient = new ZerodepDockerHttpClient.Builder()
|
||||||
.dockerHost(dockerClientConfig.getDockerHost())
|
.dockerHost(dockerClientConfig.getDockerHost())
|
||||||
.sslConfig(dockerClientConfig.getSSLConfig())
|
.sslConfig(dockerClientConfig.getSSLConfig())
|
||||||
.build();
|
.build();
|
||||||
this.dockerClient = DockerClientBuilder.getInstance(dockerClientConfig)
|
this.dockerClient = DockerClientBuilder.getInstance(dockerClientConfig)
|
||||||
.withDockerHttpClient(dockerHttpClient)
|
.withDockerHttpClient(dockerHttpClient)
|
||||||
.build();
|
.build();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -247,9 +247,9 @@ public class LocalDockerManager implements DockerManager {
|
||||||
|
|
||||||
public String getContainerIp(String containerId) {
|
public String getContainerIp(String containerId) {
|
||||||
try {
|
try {
|
||||||
return CommandExecutor.execCommand(5000, "/bin/sh", "-c",
|
return dockerClient.inspectContainerCmd(containerId).exec().getNetworkSettings().getNetworks()
|
||||||
"docker inspect -f \"{{ .NetworkSettings.IPAddress }}\" " + containerId);
|
.get("bridge").getIpAddress();
|
||||||
} catch (IOException | InterruptedException e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue