Service Virtualization

Expand all | Collapse all

How to add external DB details while running docker containers.

Jump to Best Answer
  • 1.  How to add external DB details while running docker containers.

    Posted 03-30-2017 07:04 AM

    I need to connect to external database instead of connecting to interrnal Derby database. please suggest on how to add properties detail to docker command.



  • 2.  Re: How to add external DB details while running docker containers.

    Posted 03-30-2017 08:53 AM

    Hello,

     

    On my docker project I've used environment variable "LISA_MORE_VM_PROPS" to specify database connection.

    Details of parameters are available there : Database Administration

     

    Benoit



  • 3.  Re: How to add external DB details while running docker containers.
    Best Answer

    Posted 03-30-2017 10:49 AM

    Syed,

     

    I've been running Docker commands like this -

    docker run -d --name registry -p 2010:2010 -p 1505:1505 -p 1528:1528  \
    -e LISA_MORE_VM_PROPS="-Ddevtest.enterprisedashboard.host=<dradis host> \
    -Dlisadb.internal.enabled=false \
    -Dlisadb.pool.common.driverClass=com.mysql.jdbc.Driver \
    -Dlisadb.pool.common.url=jdbc:mysql://<db url> \
    -Dlisadb.pool.common.user=<db user name>\
    -Dlisadb.pool.common.password=<db password>" \
    devtest/registry-broker-base opt/devtest/bin/Registry -n tcp://<registry host>:2010/Registry

     

    Basically, you can look up the property name in the .properties file and set it using '-e LISA_MORE_VM_PROPS' instead of changing the property file.



  • 4.  Re: How to add external DB details while running docker containers.

    Posted 03-31-2017 10:02 AM

    As well as the above specifying the properties, one can add the site.properties to /opt/devtest/site.properties with an ADD in your Dockerfile for the registry

     

    Whilst this is not dynamic, is does need to only be applied to the registry since the contents of site.properties are shared when a component connects to the registry