@@ -77,17 +77,21 @@ public class DockerEngineBackend extends AbstractDockerBackend {
7777 private static final String PROPERTY_IMG_PULL_POLICY = "image-pull-policy" ;
7878 private static final String PROPERTY_CONTAINER_NETWORK = "default-container-network" ;
7979 private static final String PROPERTY_LOKI_URL = "loki-url" ;
80+ private static final String PROPERTY_TARGET_BIND_IP = "target-bind-ip" ;
81+ private static final String DEFAULT_TARGET_BIND_IP = "127.0.0.1" ;
8082
8183 private ImagePullPolicy imagePullPolicy ;
8284 private String containerNetwork ;
8385 private String lokiUrl ;
86+ private String nonInternalTargetBindIp ;
8487
8588 @ PostConstruct
8689 public void initialize () {
8790 super .initialize ();
8891 imagePullPolicy = environment .getProperty (getPropertyPrefix () + PROPERTY_IMG_PULL_POLICY , ImagePullPolicy .class , ImagePullPolicy .IfNotPresent );
8992 containerNetwork = environment .getProperty (getPropertyPrefix () + PROPERTY_CONTAINER_NETWORK );
9093 lokiUrl = environment .getProperty (getPropertyPrefix () + PROPERTY_LOKI_URL );
94+ nonInternalTargetBindIp = environment .getProperty (getPropertyPrefix () + PROPERTY_TARGET_BIND_IP , DEFAULT_TARGET_BIND_IP );
9195 }
9296
9397 @ Override
@@ -113,7 +117,7 @@ public Proxy startContainer(Authentication user, Container initialContainer, Con
113117 // Allocate ports on the docker host to proxy to.
114118 for (eu .openanalytics .containerproxy .model .spec .PortMapping portMapping : spec .getPortMapping ()) {
115119 int hostPort = portAllocator .allocate (portRangeFrom , portRangeTo , proxy .getId ());
116- dockerPortBindings .put (portMapping .getPort ().toString (), Collections .singletonList (PortBinding .of ("0.0.0.0" , hostPort )));
120+ dockerPortBindings .put (portMapping .getPort ().toString (), Collections .singletonList (PortBinding .of (nonInternalTargetBindIp , hostPort )));
117121 portBindings .put (portMapping .getPort (), hostPort );
118122 }
119123 }
0 commit comments