Docker Community Forums

Share and learn in the Docker community.

Unable to get mysql java client to communicate from the java container to a mysql container. Not sure how to debug this


(Drgeb) #1

I have created my docker containers using crane.
I am running docker on Virtualbox Version 5.0.16 r105871.
And the host machine there is configured to be Ubuntu Wily 64 bit
4.2.0-34-generic.

The docker version there is Docker version 1.10.3, build 20f81dd.

From my MAC I can log in fine into the database, also from the Ubuntu machine in Virtualbox I can also login using a java test class I created but as soon as I go into the docker container I can’t and get an exception.

Using docker exe’: docker exec -t -i myagilefant bash I get into the container and running the java test application I get the exception.
I can ping the database fine from here.

I am not sure why I can’t communicate .

Below is my crane file and setup.

Thanks for your help!

containers:
mysqldb:
name: mysqldb
image: mysql:latest
run:
hostname: "mysqldb"
env:
- “MYSQL_DATABASE=agilefant”
- “MYSQL_USER=agilefant”
- “MYSQL_PASSWORD=agilefant”
- “MYSQL_ROOT_PASSWORD=supersecret”
- "VIRTUAL_HOST=mysqldb"
sig-proxy: true
publish-all: true
volume:
- "/data/agilefant/etc/mysql/conf.d:/etc/mysql/conf.d"
publish:
- 7306:3306
net: agilefant-net
detach: true
myagilefant:
requires: [“mysqldb”]

image: myagilefant
run:
   hostname: "agilefant.dev"
   publish:
       - "51175:8080"
       - "51176:4848"
   env:
       - "VIRTUAL_HOST=agilefant.dev"
   volume:
       - "/data/agilefant/conf/tomcat-users.xml:/usr/local/tomcat/conf/tomcat-users.xml"
       - "/data/agilefant/conf/logging.properties:/usr/local/tomcat/conf/logging.properties"
       - "/data/agilefant/lib/mysql-connector-java-5.1.38-bin.jar:/usr/local/tomcat/lib/mysql-connector-java-5.1.38-bin.jar"
       - "/data/agilefant/logs:/usr/local/tomcat/logs"
       - "/data/agilefant/webapps/agilefant.war:/usr/local/tomcat/webapps/agilefant.war"
       - "/data/agilefant/lib/testjdbc-1.0-SNAPSHOT-jar-with-dependencies.jar:/usr/local/tomcat/testjdbc-1.0-SNAPSHOT-jar-with-dependencies.jar"
   env:
       - "VIRTUAL_HOST=agilefant.dev"
   net: agilefant-net
   detach: true

networks:
agilefant-net