title: Application running in docker container not reachable in docker host
body: <p>I have Ubuntu 18.04 virtual machine in the Windows Operating system. In the virtual machine, docker is installed and it is the docker host. Created an image using Oracle Linux7 to install Weblogic 12 and started the application manually logging to the container. The ports are mapped successfully and Weblogic is running inside the container but it is not accessible in the docker host and outside the docker host.
  I would like to know if I am missing any configuration and would like to know how to troubleshoot the docker networking to fix this issue.</p>
  
  <pre><code>FROM oraclebase:v2  # Have the base image created where I have installed Java
  #prerequisite create_basedomain.py, verdomain.properties,fmw_12.2.1.0.0_wls_Disk1_1of1.zip
  
  USER root
  
  ENV JAVA_HOME /opt/jdk/jdk1.8.0_131
  ENV WLS_PKG fmw_12.2.1.0.0_wls_Disk1_1of1.zip
  ENV WLS_JAR fmw_12.2.1.0.0_wls.jar
  ENV CREATE_DOMAIN_SCRIPT create_basedomain.py
  #This properties file should be passed as a template file. not env specific.
  ENV DOMAIN_PROPERTIES verdomain.properties
  
  # Prerequisites
  # any prerequisite packages for Weblogic
  
  # Create Oracle base directories
  RUN mkdir -p /u01/app/oracle/product/wls122100 &amp;&amp; \
      mkdir -p /u01/app/oracle/config/domains &amp;&amp; \
      mkdir -p /u01/app/oracle/config/applications
  
  COPY $WLS_PKG wls.rsp oraInst.loc /u01/app/oracle/
  COPY $CREATE_DOMAIN_SCRIPT /u01/app/oracle
  COPY $DOMAIN_PROPERTIES /u01/app/oracle
  
  # Create functional useraccount
  RUN chmod a+xr /u01 &amp;&amp; useradd -b /u01 -m -s /bin/bash oracle
  WORKDIR /u01/app/oracle/
  RUN chown oracle:oracle -R /u01
  USER oracle
  
  # Adjust paths as required.
  ENV CONFIG_JVM_ARGS="-Djava.security.egd=file:/dev/./urandom"
  ENV ORACLE_BASE /u01/app/oracle
  ENV ORACLE_HOME $ORACLE_BASE/product/wls122100
  ENV MW_HOME $ORACLE_HOME
  ENV WLS_HOME $MW_HOME/wlserver
  ENV WL_HOME $WLS_HOME
  ENV DOMAIN_BASE $ORACLE_BASE/config/domains
  ENV DOMAIN_HOME $DOMAIN_BASE/mydomain
  ENV PATH="${WLS_HOME}/server/bin:${PATH}"
  ENV CLASSPATH=${CLASSPATH}:${WLS_HOME}/server/lib/weblogic.jar:.
  
  RUN echo "export ORACLE_BASE=/u01/app/oracle" &gt;&gt; /u01/oracle/.bash_profile
  RUN echo "export ORACLE_HOME=$ORACLE_BASE/product/wls122100" &gt;&gt; /u01/oracle/.bash_profile
  RUN echo "export MW_HOME=$ORACLE_HOME" &gt;&gt; /u01/oracle/.bash_profile
  RUN echo "export WLS_HOME=$MW_HOME/wlserver" &gt;&gt; /u01/oracle/.bash_profile
  RUN echo "export WL_HOME=$WLS_HOME" &gt;&gt; /u01/oracle/.bash_profile
  RUN echo "export DOMAIN_BASE=$ORACLE_BASE/config/domains" &gt;&gt; /u01/oracle/.bash_profile
  RUN echo "export DOMAIN_HOME=$DOMAIN_BASE/mydomain" &gt;&gt; /u01/oracle/.bash_profile
  RUN echo "PATH=$PATH:$WL_HOME/server/bin" &gt;&gt; /u01/oracle/.bash_profile
  RUN echo "export CLASSPATH=${CLASSPATH}:${WLS_HOME}/server/lib/weblogic.jar:." &gt;&gt; /u01/oracle/.bash_profile
  RUN echo ". \$WL_HOME/server/bin/setWLSEnv.sh" &gt;&gt; /u01/oracle/.bash_profile
  
  RUN unzip $WLS_PKG 
  RUN $JAVA_HOME/bin/java -Xmx1024m -jar /u01/app/oracle/$WLS_JAR -silent -responseFile /u01/app/oracle/wls.rsp -invPtrLoc /u01/app/oracle/oraInst.loc &gt; install.log
  RUN rm -f $WLS_PKG
  
  RUN . $WLS_HOME/server/bin/setWLSEnv.sh &amp;&amp; java weblogic.version
  RUN java weblogic.WLST -skipWLSModuleScanning create_basedomain.py
  
  #end of file
  </code></pre>
  
  <p>Created the image like below</p>
  
  <pre><code>docker build -f Dockerfile-weblogic12c.2 --tag="weblogic12c:v2" /var/docker-projects
  </code></pre>
  
  <p>Started the container like below</p>
  
  <pre><code>docker run -d -p 0.0.0.0:7001:7001 -it weblogic12c:v2 bash
  </code></pre>
  
  <p>Started the Weblogic like below</p>
  
  <pre><code>docker exec -it &lt;container id&gt; bash
  </code></pre>
  
  <p>Manually logged in to the container and executed ./startWeblogic.sh</p>
  
  <pre><code>root@osboxes:/var/docker-projects# docker ps -a
  CONTAINER ID        IMAGE                COMMAND                  CREATED             STATUS                  PORTS                    NAMES
  20f249affaa9        weblogic12c:v2   "/bin/bash"              4 hours ago         Up 14 minutes           0.0.0.0:7001-&gt;7001/tcp   infallible_poincare
  </code></pre>
  
  <p>Tested the URL like below.</p>
  
  <pre><code>root@osboxes:/var/docker-projects# curl -Is http://172.17.0.2:7001/
  root@osboxes:/var/docker-projects# echo $?
  7
  </code></pre>
  
  <p>Weblogic started and running inside the container.</p>
  
  <pre><code>&lt;Apr 1, 2019 6:15:59 PM UTC&gt; &lt;Notice&gt; &lt;Security&gt; &lt;BEA-090947&gt; &lt;Security post-initializing using security realm: myrealm&gt;  &lt;Apr 1, 2019 6:16:07 PM UTC&gt; &lt;Notice&gt; &lt;Security&gt; &lt;BEA-090082&gt; &lt;Security initialized using administrative security realm: myrealm&gt;  &lt;Apr 1, 2019 6:16:22 PM UTC&gt; &lt;Notice&gt; &lt;WebLogicServer&gt; &lt;BEA-000365&gt; &lt;Server state changed to STANDBY.&gt;  &lt;Apr 1, 2019 6:16:22 PM UTC&gt; &lt;Notice&gt; &lt;WebLogicServer&gt; &lt;BEA-000365&gt; &lt;Server state changed to STARTING.&gt;  &lt;Apr 1, 2019 6:16:23 PM UTC&gt; &lt;Notice&gt; &lt;Log Management&gt; &lt;BEA-170036&gt; &lt;The Logging monitoring service timer has started to check for logged message counts every 30 seconds.&gt;  &lt;Apr 1, 2019 6:16:26 PM UTC&gt; &lt;Notice&gt; &lt;Log Management&gt; &lt;BEA-170027&gt; &lt;The server has successfully established a connection with the Domain level Diagnostic Service.&gt;  &lt;Apr 1, 2019 6:16:27 PM UTC&gt; &lt;Notice&gt; &lt;WebLogicServer&gt; &lt;BEA-000365&gt; &lt;Server state changed to ADMIN.&gt;  &lt;Apr 1, 2019 6:16:27 PM UTC&gt; &lt;Notice&gt; &lt;WebLogicServer&gt; &lt;BEA-000365&gt; &lt;Server state changed to RESUMING.&gt;  &lt;Apr 1, 2019 6:16:28 PM UTC&gt; &lt;Notice&gt; &lt;Server&gt; &lt;BEA-002613&gt; &lt;Channel "Default" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.&gt;  &lt;Apr 1, 2019 6:16:28 PM UTC&gt; &lt;Notice&gt; &lt;WebLogicServer&gt; &lt;BEA-000331&gt; &lt;Started the WebLogic Server Administration Server "adminserver" for domain "verdomain" running in development mode.&gt;  &lt;Apr 1, 2019 6:16:28 PM UTC&gt; &lt;Notice&gt; &lt;Server&gt; &lt;BEA-002613&gt; &lt;Channel "Default" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.&gt;  &lt;Apr 1, 2019 6:16:28 PM UTC&gt; &lt;Notice&gt; &lt;WebLogicServer&gt; &lt;BEA-000360&gt; &lt;The server started in RUNNING mode.&gt;  &lt;Apr 1, 2019 6:16:28 PM UTC&gt; &lt;Notice&gt; &lt;WebLogicServer&gt; &lt;BEA-000365&gt; &lt;Server state changed to RUNNING.&gt;
  </code></pre>
  
  <p>Ip address of the container and interface details.</p>
  
  <pre><code>[oracle@20f249affaa9 oracle]$ ip addr show
  1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
      inet 127.0.0.1/8 scope host lo
         valid_lft forever preferred_lft forever
  4: eth0@if5: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc noqueue state UP group default 
      link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff link-netnsid 0
      inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0
         valid_lft forever preferred_lft forever
  </code></pre>
  
  <p>The return status, the host is not reachable. The IP is the container IP and trying to hit the URL from the docker host. I am connected using a bridged network.</p>
  
  <p>The URL is accessble inside the container but not in the docker host.</p>
  
  <pre><code>[oracle@20f249affaa9 oracle]$ curl -Is http://localhost:7001/console
  HTTP/1.1 200 OK
  Connection: close
  Date: Mon, 01 Apr 2019 18:49:19 GMT
  Content-Length: 416
  
  root@osboxes:/var/docker-projects# curl -Is http://localhost:7001/console
  root@osboxes:/var/docker-projects# echo $?
  52
  </code></pre>
  
  <p>Please help me how to debug the docker networking, root cause for this issue. I did google and it says that I have to use -p 0.0.0.0:7001:7001 or just -p 7001:7001 to expose the port.</p>