我没有在任何帖子上找到答案.
我在容器上使用带有PHP项目的容器,该容器工作正常.我想链接在另一个容器上启动的Java.
我使用“java:8”图像配置如下:
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"
在我的docker PHP容器(调用“引擎”)上,我有这个环境变量.
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命令工作正常.但是我怎么能用java呢?我尝试使用该命令
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#
也许我必须分享一卷?我可以通过TCP协议使用Java吗?
最佳答案
原文链接:https://www.f2er.com/docker/436609.html