Issue type : Docker Container not able to connect to external host
OS Version/build : Darwin Kernel Version 18.6.0 and Local Mac book I am running the docker
App version : Docker version 18.09.2, build 6247962
Steps to reproduce
Docker container need to connect to the external host IP/host name from my local container which has a tomcat running with webapplication
and it is giving me the below error.
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException Internal
Exception: java.sql.SQLException: Cannot create PoolableConnectionFactory (IO Error: The Network Adapter could not establish the connection) Error Code: 0
Even I tried the ping with IP and host name but both are not able to reach from the docker container. But my mac book I am able to ping those host.
I tried different options like setting up the network_mode as host and bridge and nothing resolved issue. Tomcat is up and running but final connection to
oracle on premise host is failing from container and it is working from my local laptop.
Could you please help me on resolving the issue.
Dockerfile
FROM tomcat
COPY odata-sample.war /usr/local/tomcat/webapps/
COPY odata.war /usr/local/tomcat/webapps/
COPY tomcat-users.xml /usr/local/tomcat/conf/
COPY context.xml /usr/local/tomcat/conf/
COPY server.xml /usr/local/tomcat/conf/
CMD [“catalina.sh”, “run”]
docker-compose.yml
version: ‘3.4’
services:
odatawar:
extra_hosts:
- “:”
network_mode: “bridge”
build:
context: .
dockerfile: Dockerfile
ports:
- target: 8080
published: 8080
protocol: tcp
mode: bridge