-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
chore: add expose to dockerfile #29754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks! |
|
This will only work if the port config is kept default though? Might be worth a line somewhere in the docs (not sure if it's limited to Traefik or not). |
What exactly do you mean? services:
zigbee2mqtt:
image: koenkk/zigbee2mqtt
ports:
- 8082:8080
labels:
- "traefik.enable=true"You can access the frontend via :8082 (host port) |
|
frontend:
enabled: true
port: 8181Z2M frontend/websocket will be on 8181. zigbee2mqtt/lib/extension/frontend.ts Lines 48 to 140 in 5797b56
|
|
Ah, thank you for the clarification! I wasn't aware the port could also be changed via the configuration.yaml file. The problem is that the
For anyone who needs to use a different port, the recommended approach is to explicitly configure the reverse proxy. For example, with Traefik, you can use labels in your docker run command to specify the correct port. This overrides the hint from EXPOSE. Here is an example: docker run \
-l "traefik.enable=true" \
-l "traefik.http.services.zigbee2mqtt.loadbalancer.server.port=9090" \
koenkk/zigbee2mqttThis ensures Traefik directs traffic to the correct port (9090 in this case), regardless of what is set in the Dockerfile's EXPOSE instruction. |
True (it will also be not correct when the frontend is completely disabled). But I think it's fine to have the default port listed here because in by far most of the setups I expect this will be the correct port. |
|
I was thinking maybe a little line in the docs for this kind of use should be added (Frontend config page?). Something along the lines of what was said here |
I have added the
EXPOSE 8080instruction to the application Dockerfile.While working with Traefik locally, the service was not accessible because Traefik could not detect the correct port. By default, Traefik looks for the
EXPOSEinstruction to determine which port to route traffic to.This change ensures: