当我为侦听端口 8090 的 Web 应用程序运行容器时
和
docker run -p 8090:8090 -h=%ComputerName% mycontainer
然后我就可以访问http://localhost:8090上的服务
如果我启动容器
docker run --net="host" -h=%ComputerName% mycontainer
然后我无法访问http://localhost:8090上的服务
为什么 ??
不应该使用 -net="host" 容器共享主机的网络,那么为什么我无法使用--net="host"访问http://localhost:8090
如何在 Java 8 中完成?
if (var1 != null && var2!=null) {
callMethod(var1,var2);
}
Run Code Online (Sandbox Code Playgroud)
我在想这样的事情,但有两个变量:
Optional.ofNullable(var1).ifPresent(var1 -> callMethod(var1));
Run Code Online (Sandbox Code Playgroud)