Remote debugging Java 9 in a docker container from IntelliJ IDEA : <p>I have a Dockerfile with this content:</p>

<pre><code>FROM openjdk:9

WORKDIR /project

ADD . /project

EXPOSE 5005
</code></pre>

<p>My docker-compose.yml looks like this:</p>

<pre><code>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"
</code></pre>

<p>When I do <strong>docker-composer up</strong> I see a message "<em>Listening for transport dt_socket at address: 5005</em>". But when I try to connect with jdb or Idea I get "<em>java.io.IOException: handshake failed - connection prematurally closed</em>".</p>

<p>Everything works fine if I change <strong>openjdk:9</strong> to <strong>openjdk:8</strong>. However, I need Java 9 for my project. </p>
