Docker plugin doesn't create port bindings
Answered
I have been playing with the Docker plugin. So far it all works great and I can build, start, stop and otherwise interact with images and containers quite successfully.
I can't seem to get a Docker Deployment configuration to actually create a port binding. I put in a port binding, started a container and.... nothing. Running docker from the command line with a -p argument works fine. Tried stopping and starting my Docker connection, starting and stopping IntelliJ and still no joy.


Here are a few snapshots of my configuration. Am I missing something?
Please sign in to leave a comment.
Does https://youtrack.jetbrains.com/issue/IDEA-167575#comment=27-2196290 comment help?
Serge! As usual you are most helpful. Yes, as soon as I put in an explicit EXPOSE entry in my Dockerfile then the port mappings worked as expected. Thanks :)
I think this still isn't quite right though, because running the command line with the -p option still works, even when the EXPOSE command isn't in the Docker file.
Apparently the -p option should create an implicit EXPOSE. But this doesn't seem to be the case when creating a port binding in the run/debug configuration.
So isn't this still a bug? Shouldn't creating a port binding in the run/debug configuration have the same behavior as running the -p option from the command line?
I'd prefer to not have to manually EXPOSE dev-environment ports in my Dockerfile, when production environments will be using different ports.
@Curl Siffert
I agree. And finally in the new plugin version for 2017.3 all the ports that have bindings should be automatically implicitly exposed by the plugin.
If you see the problems with the new implementation, please reopen IDEA-149314.