Reputation: 414
My script was running completely fine in my localhost until I started running it inside a Docker Container. I do not know what went wrong. I get INFO: Connection to DB failed! due to Exception: No password or public key available! error
My db_config.py file :
with SSHTunnelForwarder(
(<Bastian Host IP>, 22),
ssh_username=<user>,
ssh_pkey='oalkey.openssh',
ssh_private_key_password=<pass>,
remote_bind_address=(<Remote DB IP>, 1521),
local_bind_address=('localhost', 1521)
) as tunnel:
dsn_tns =
cx_Oracle.makedsn(os.getenv("LOCAL_BIND_HOST",'localhost'),os.getenv("SSH_TUNNEL_PORT",1521),
service_name=os.getenv("OCI_DSP_SERVICE","default"))
self.db_connection = cx_Oracle.connect(os.getenv("OCI_DAS_NAME"),
os.getenv("OCI_DAS_PASS"), dsn_tns)
logger.info('Connection to DB successful')
#server.stop()
except Exception as ex:
logger.info('Connection to DB failed! due to Exception: {}'.format(ex))
Upvotes: 1
Views: 473
Reputation: 414
Oh, i fixed the issue. It was because the WORKDIR in my Dockerfile was pointing to the root location and I had to write the relative path in the ssh_pkey='oalkey.openssh' to ssh_pkey='app/var/www/oalkey.openssh'. Simple :-)
Upvotes: 1