Reputation: 213
I am running jetty from a docker-composer.yml file. I had changed the port mapping like this:
services:
web:
image: jetty
ports:
- "8000:8000"
This does not change the port that jetty starts up on. How do I go about doing this from a dockerized jetty?
Upvotes: 1
Views: 1628
Reputation: 1721
So I found that changing -Djetty.port
did not fix my issues.
However when I added -Djetty.http.port=9900
in my docker compose I could then expose the port in the docker compose as follows
services:
ports:
- "9900:9900"
environment:
- JAVA_OPTIONS=-Djetty.http.port=9900
Upvotes: 0
Reputation: 51
Perhaps unrelated, yet helpful:
I had a similar issue in a Dockerfile
and I chose to override the default jetty port in jetty-http.xml (located in /usr/local/jetty/etc
) by rewriting the file:
FROM jetty:10-....
COPY jetty-http.xml /usr/local/jetty/etc
COPY target/some-war.war /var/lib/jetty/webapps/ROOT.war
...
Upvotes: 0
Reputation: 146630
By default jetty runs on port 8080
. So you compose file should be
services:
web:
image: jetty
ports:
- "8000:8080"
This maps port 8080
from inside the container to port 8000
on your host. Though you should not need to run jetty on port 80 inside the container. But if you still need to for some reason then you need to use the jetty config options using JAVA_OPTIONS
services:
web:
image: jetty
environment:
JAVA_OPTIONS: "-Djetty.port=80"
ports:
- "8000:80"
So port 80
inside the container and port 8000
on your host machine.
Upvotes: 3