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.
Asked
Active
Viewed 1,051 times
2
-
What specific command are you running? What are you expecting to see happening, that isn’t? – David Maze Jul 25 '18 at 17:25
-
The command is "docker run -it -p 8080:8080 jboss/wildfly", I expect it to run a jboss server instance but using a port distinct to 8080, for example: docker run -it -p 8085:8085 jboss/wildfly, I need to use another port. – Rodrigo Iván Lea Plaza Chávez Jul 25 '18 at 18:09
-
The instance always runs with port 8080 despite use port 8085 in the command. – Rodrigo Iván Lea Plaza Chávez Jul 25 '18 at 18:17
1 Answers
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).
![](../../users/profiles/4069345.webp)
joelnb
- 1,315
- 9
- 13