Docker communication between two container with Java

I don’t find my answer on any post.

I use a container with a project under PHP on a container which works
fine. I want to link Java which is launch on another container.

I use the “java:8” image configure like this :

engine:
    build: ./docker/engine/
    volumes:
        - ".:/home/docker:rw"
        - "./docker/engine/php.ini:/usr/local/etc/php/conf.d/custom.ini:ro"
    links:
        - "db:db"
        - "java:java"
    working_dir: "/home/docker"
java:
    image: java:8
    tty: true
    ports:
        - "999:999"

On my docker PHP container (call “engine”), I have this environment variable.

JAVA_1_ENV_CA_CERTIFICATES_JAVA_VERSION=20140324
JAVA_1_ENV_JAVA_DEBIAN_VERSION=8u72-b15-1~bpo8+1
JAVA_1_ENV_JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
JAVA_1_ENV_JAVA_VERSION=8u72
JAVA_1_ENV_LANG=C.UTF-8
JAVA_1_NAME=/recetteetudiant_engine_1/java_1
JAVA_1_PORT=tcp://172.17.0.3:999
JAVA_1_PORT_999_TCP=tcp://172.17.0.3:999
JAVA_1_PORT_999_TCP_ADDR=172.17.0.3
JAVA_1_PORT_999_TCP_PORT=999
JAVA_1_PORT_999_TCP_PROTO=tcp
JAVA_ENV_CA_CERTIFICATES_JAVA_VERSION=20140324
JAVA_ENV_JAVA_DEBIAN_VERSION=8u72-b15-1~bpo8+1
JAVA_ENV_JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
JAVA_ENV_JAVA_VERSION=8u72
JAVA_ENV_LANG=C.UTF-8
JAVA_NAME=/recetteetudiant_engine_1/java
JAVA_PORT=tcp://172.17.0.3:999
JAVA_PORT_999_TCP=tcp://172.17.0.3:999
JAVA_PORT_999_TCP_ADDR=172.17.0.3
JAVA_PORT_999_TCP_PORT=999
JAVA_PORT_999_TCP_PROTO=tcp
RECETTEETUDIANT_JAVA_1_ENV_CA_CERTIFICATES_JAVA_VERSION=20140324
RECETTEETUDIANT_JAVA_1_ENV_JAVA_DEBIAN_VERSION=8u72-b15-1~bpo8+1
RECETTEETUDIANT_JAVA_1_ENV_JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
RECETTEETUDIANT_JAVA_1_ENV_JAVA_VERSION=8u72
RECETTEETUDIANT_JAVA_1_ENV_LANG=C.UTF-8
RECETTEETUDIANT_JAVA_1_NAME=/recetteetudiant_engine_1/recetteetudiant_java_1
RECETTEETUDIANT_JAVA_1_PORT=tcp://172.17.0.3:999
RECETTEETUDIANT_JAVA_1_PORT_999_TCP=tcp://172.17.0.3:999
RECETTEETUDIANT_JAVA_1_PORT_999_TCP_ADDR=172.17.0.3
RECETTEETUDIANT_JAVA_1_PORT_999_TCP_PORT=999
RECETTEETUDIANT_JAVA_1_PORT_999_TCP_PROTO=tcp

Ping command works fine. But how can I use java with that? I try to use that command

root@639144f7c95f:/home/docker# echo $JAVA_1_PORT$RECETTEETUDIANT_JAVA_1_ENV_JAVA_HOME
tcp://172.17.0.3:999/usr/lib/jvm/java-8-openjdk-amd64
root@639144f7c95f:/home/docker# /recetteetudiant_engine_1/java_1
bash: /recetteetudiant_engine_1/java_1: No such file or directory
root@639144f7c95f:/home/docker# $JAVA_1_PORT$RECETTEETUDIANT_JAVA_1_ENV_JAVA_HOME     
bash: tcp://172.17.0.3:999/usr/lib/jvm/java-8-openjdk-amd64: No such file or directory
root@639144f7c95f:/home/docker#

Maybe I have to share a volume ? Can I use Java through TCP protocol?