# Docker compose java and mysql

**URL:** <https://forums.docker.com/t/docker-compose-java-and-mysql/49340>\
**Category:** Compose\
**Tags:** docker\
**Created:** [April 12, 2018, 8:40pm UTC](https://forums.docker.com/t/docker-compose-java-and-mysql/49340 "2018-04-12T20:40:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![crismon01](https://avatars.discourse-cdn.com/v4/letter/c/e68b1a/32.png) [@crismon01](https://forums.docker.com/u/crismon01)\
**Post date:** [April 12, 2018, 8:40pm UTC](https://forums.docker.com/t/docker-compose-java-and-mysql/49340/1 "2018-04-12T20:40:26Z")

</div>

Hi, i have this file compose:  
and i have do a services that use the java code of LogIn.jar do do a query to a db, but in the compose i don’t know how to do the interaction with the shell, if i run this like container i use the exec to use the shell of java container but there?

```
version: '3.3'

services:
  db:
    container_name: dbContainer
    image: mysql:5.7
    volumes:
    - /home/crismon-01/Documenti/TESI/Docker/mysqlLogin/datas:/var/lib/mysql
    ports:
    - 3306
    environment:
     MYSQL_ROOT_PASSWORD: "root"
     MYSQL_USER: "root"
     MYSQL_PASSWORD: "root"
     MYSQL_DATABASE: "schema1"
  java:
    container_name: loginJava
    image: openjdk:8
    depends_on:
    - db
    volumes:
    - .:/usr/src/myapp 
    working_dir: /usr/src/myapp
    command: bash -c "cd /usr/src/myapp && java -jar LogIn.jar"  
    stdin_open: true
    tty: true
```
