I am new to docker, I am trying to run spring boot app (microservice) in docker container, app is trying to access a oracle db on network not running inside docker container
public DataSource oracleDataSource() throws SQLException {
final SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
dataSource.setDriver(new OracleDriver());
dataSource.setUrl("jdbc:oracle:thin:@kdb-us-engdba11:1521:ora11gr2");
dataSource.setUsername("xxx");
dataSource.setPassword("xxx");
return dataSource;
}
It works fine when same code is run from eclipse but when running inside docker container it throws java.net.UnknownHostException: kdb-us-engdba11: unknown error. I tried
docker run --add-host=kdb-us-engdba11.int.kronos.com:10.48.151.183..."
and "docker run --net=host .....
both option does not seems like helping, how to access network resource from docker container. I am running the code on mac with Boot2Docker for OSX.
Thanks, Rahul