I am trying to set up a development environment for a spring-boot project based on dockers and strollers. I use IntelliJ running on Windows to write code and vagrants to be able to run a project in docker containers on any system. I am building a project with maven. Currently, I can run an application packaged in a jar in a docker container running in ubuntu on a virtual box through a tramp. I can’t understand how to debug my application in IntelliJ, I run the application with remote debugging, correctly (or at least I think everything is correct) sets up port forwarding, but IntelliJ still tells me “Connection reset”, and cannot connect to the debugger.
Here is my Docker file:
FROM java:8 VOLUME /tmp ADD test-1.0-SNAPSHOT.jar app.jar ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Xdebug -Xrunjdwp:server=y,transport=dt_socket,suspend=n,address=8000", "-jar", "/app.jar"]
Vagrantfile:
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'docker' Vagrant.configure("2") do |config| config.vm.define "app" do |a| a.vm.provider "docker" do |d| d.vagrant_machine = "dockerhost" d.vagrant_vagrantfile = "./Vagrant_docker_wrapper" d.build_dir = "." d.build_args = ["-t=app"] d.ports = ["8080:8080", "8000:8000"] d.name = "app" d.remains_running = true d.has_ssh = true d.cmd = ["run"] end end end
And Vagrant_docker_wrapper:
Vagrant.configure("2") do |config| config.vm.provision "docker" config.vm.provision "shell", inline: "ps aux | grep 'sshd:' | awk '{print $2}' | xargs kill" config.vm.define "dockerhost" config.vm.box = "ubuntu/trusty64" config.vm.network "forwarded_port", guest: 8080, host: 9080 config.vm.network "forwarded_port", guest: 8000, host: 9081 config.vm.provider :virtualbox do |vb| vb.name = "dockerhost" end end
I created these files using http://blog.zenika.com/2014/10/07/Setting-up-a-development-environment-using-Docker-and-Vagrant/ and https://spring.io/guides / gs / spring-boot-docker /
In IntelliJ, I added a new remote debugging configuration and set the port to 9081. If anyone has any idea how I should configure this environment to work in debug mode, I will be happy for any help.
If I can connect to the debugger in my application, I also want some hot swaps and static resources to reload functionality without having to recompile with maven and reload dockers. Therefore, any help in this area will also be great, but it should not have.