我有一个Dockerfile,内容如下:
FROM openjdk:9
WORKDIR /project
ADD . /project
EXPOSE 5005
我的 docker-compose.yml 文件如下:
version: "3.2"
services:
some-project:
build: .
ports:
- target: 5005
published: 5005
protocol: tcp
mode: host
command: "java '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005' SomeClass"
当我执行docker-composer up时,我看到一条消息 "Listening for transport dt_socket at address: 5005"。但是当我尝试使用jdb或Idea连接时,我会收到 "java.io.IOException: handshake failed - connection prematurally closed"。如果我将openjdk:9更改为openjdk:8,则一切正常运作。然而,我的项目需要Java 9。