24 July 2016

Running Docker Wildfly/JBoss Application Server in Debug mode via Eclipse

I have recently built the whole Development Environment of Java Enterprise Edition (J2EE) project on multiple Docker containers. It has saved the hassle of setting up a dev env for new developers. All it takes to setup the environment is to clone our github repositories and run the Docker images.

I will explain the setup in a future post.

Build Wildfly Docker Image with Debugging Enabled

So basically in order to run the Wildfly in debug mode, we need to add --debug flag to the Wildfly standalone.sh startup script.

Also we need to expose port 8787 in our image as it's the default port for Wildfly JVM debug mode.

1. Create or change your Wildfly Dockerfile as follows:
$ cat Dockerfile
FROM jboss/wildfly:10.0.0.Final
EXPOSE 8787 
CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "", "-bmanagement", "", "--debug"]
2. Build and tag the image:
$ docker build -t wildfly-debug .
3. Run the image either via  docker run:
$ docker run -it -p 8080:8080 -p 8787:8787 --name wfdebug wildfly-debug 
or via docker-compose:
$ cat docker-compose.yml
version: '2'
    image: wildfly-debug
      - "8080:8080"
      - "8787:8787"
$ docker-compose up wfdebug

Eclipse Settings:

In the Eclipse, go to following path:

Window -> Perspective -> Open Perspective -> Debug

Now click on the arrow key next to the Debug button and choose "Debug Configurations"

On the left sidebar, choose "Remote Java Application", right click and New. 

- Give it a Name
- In the Connect tab, left the Project blank
- Choose the Connection Type as "Standard (Socket Attach)"
- Connection Properties: Host: "localhost", Port: "8787"
- In the Source tab, click Add, choose Java Project, and choose the project(s) you want to debug

Apply the changes, and click on Debug!

Boom! It should now connect to the remote Wildfly server running on docker in Debug mode.

I have faced below error several times whenever I don't properly follow the mentioned steps:
"Failed to connect to remote VM. Connection refused."


  1. Do not waste time winning money right now we have slot games Win an online casino.

  2. Sorry,
    it's possible to set debug mode from docker-compose?
    How can to copy standalone.sh into Wildfly?

    Thank for all

  3. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
    DevOps Online Training

    DevOps Training in Pune

  4. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    Devops Training in Electronic City

  5. Writing with style and getting good compliments on the article is quite hard, to be honest.But you've done it so calmly and with so cool feeling and you've nailed the job. This article is possessed with style and I am giving good compliment. Best! Latest & Updated Version

  6. I am overwhelmed by your post with such a nice topic. Usually I visit your blogs and get updated through the information you include but today’s blog would be the most appreciable. Well done! Tubidy Mobile Music MP3 Downloader Download

  7. ERP software testing is definitely a essential element of integrating and employing it for business development and related functions. Here's a detailed guide for any same. Online Docker Training

  8. I can’t say nothing but refute it until I have done the whole process in order to get the results and analyze them.