2

I have the command "docker run -it -p 8080:8080 jboss/wildfly" to run a server instance in wildfly. How can I change port 8080?, when I run the command with another port, for example 8085, the server instance is always executed with port 8080.

1 Answers1

3

Changing the command from:

docker run -it -p 8080:8080 jboss/wildfly

to

docker run -it -p 8085:8085 jboss/wildfly

Does not change the port that the jboss server inside the image listens on. What it does is tells docker to forward port 8085 on your local machine to port 8085 on the container.

If what you want to achieve is simply that you can connect to jboss on port 8085 on your local machine then you could just forward port 8085 on your local machine to 8080 in the container:

docker run -it -p 8085:8080 jboss/wildfly

If you have a real need to actually change the port jboss listens on inside the container then you would need to do something like this (disclaimer: I don't use jboss):

docker run -it -p 8085:8085 jboss/wildfly -Djboss.socket.binding.port-offset=5

Apparently this option can be used to modify the port (in this case increasing it by 5).

joelnb
  • 1,315
  • 9
  • 13