Port configurable via environment #1895
Replies: 3 comments 3 replies
-
While |
Beta Was this translation helpful? Give feedback.
-
@alexjustesen Thank you for the quick reply. Apologies as I don't think I was clear in the initial request. Please let me provide a more concrete example using a pared-down, anonymized version of my code. invocation
docker-composename: MY_STACK
secrets:
SPEEDTEST_APP_KEY:
file: /opt/docker/_secrets/SPEEDTEST_APP_KEY
SPEEDTEST_APP_URL:
file: /opt/docker/_secrets/SPEEDTEST_APP_URL
OPENVPN_USER:
file: /opt/docker/_secrets/OPENVPN_USER
OPENVPN_PASSWORD:
file: /opt/docker/_secrets/OPENVPN_PASSWORD
include:
- ./services/speedtest-tracker.yml
- ./services/swag.yml
- ./services/gluetun.yml service configsswagservices:
swag:
image: lscr.io/linuxserver/swag:latest
container_name: swag
cap_add:
- NET_ADMIN
env_file:
- ../MYENV.ENV
environment:
- URL=EXAMPLE.COM
- VALIDATION=dns
- CERTPROVIDER=zerossl
- SUBDOMAINS=wildcard
- DNSPLUGIN=cloudflare
- PROPAGATION=30
- [email protected]
volumes:
- /opt/docker/swag:/config
ports:
- 443:443
restart: unless-stopped gluetunservices:
gluetun:
image: qmcgaw/gluetun
container_name: gluetun
cap_add:
- NET_ADMIN
secrets:
- OPENVPN_USER
- OPENVPN_PASSWORD
env_file:
- ../MYENV.ENV
environment:
- VPN_SERVICE_PROVIDER=MYVPNPROVIDER
- VPN_TYPE=openvpn
- SERVER_COUNTRIES=United States
- OPENVPN_USER_SECRETFILE=/run/secrets/OPENVPN_USER
- OPENVPN_PASSWORD_SECRETFILE=/run/secrets/OPENVPN_PASSWORD
devices:
- /dev/net/tun:/dev/net/tun
volumes:
- /opt/docker/gluetun:/gluetun
ports:
- 8443:8443 # speedtest-tracker
restart: always speedtest-trackerservices:
speedtest-tracker:
image: lscr.io/linuxserver/speedtest-tracker:latest
container_name: speedtest-tracker
network_mode: container:gluetun
depends_on:
gluetun:
condition: service_healthy
secrets:
- SPEEDTEST_APP_KEY
- SPEEDTEST_APP_URL
env_file:
- ../MYENV.ENV
environment:
- FILE__APP_KEY=/run/secrets/SPEEDTEST_APP_KEY
- FILE__APP_URL=/run/secrets/SPEEDTEST_APP_URL
- SPEEDTEST_SCHEDULE=0 4 * * *
- DISPLAY_TIMEZONE=America/Chicago
- PRUNE_RESULTS_OLDER_THAN=90
volumes:
- /opt/docker/speedtest-tracker/data:/config speedtest-tracker.subdomain.conf (for reverse proxy)Relevant portion, adapted from template here.
discussionFor any container not on If I read your suggestion correctly, you're saying I should just services:
speedtest-tracker:
image: lscr.io/linuxserver/speedtest-tracker:latest
container_name: speedtest-tracker
network_mode: container:gluetun
depends_on:
gluetun:
condition: service_healthy
...
ports:
- 8443:8443 but this is not valid Since services like gluetun are increasingly popular, I'm seeing docker services increasingly allowing for ports to be specified as an environment variable, which is valid docker syntax. An example would be the final thoughtsThanks for reading through all this. I appreciate the work you put into this service, this issue notwithstanding. For what it's worth, I have searched a number of speed test services; this one seems the most feature-complete and actively maintained. I'd really love to use it going forward, and the ability to get it working inside the VPN+reverse-proxy framework would be icing on the cake. |
Beta Was this translation helpful? Give feedback.
-
The nginx webserver is part of the docker image build by LSIO. We cannot control which port is used on the inside of the container, I don't think they have a env for setting the port. I looked around in the container. There is an |
Beta Was this translation helpful? Give feedback.
-
Hi. Apologies if this is a 🔴 very bad idea 🔴 , I'm still somewhat new to networking. But here goes:
I'm running a stack that binds various services to a VPN via
network_mode: container:gluetun
. Ideally I'd like my speed test provider to be similarly bound so that I can examine the speed I'm getting on the VPN. However, using this network mode means I can't manually specifyports
in thespeedtest-tracker
service config in mydocker compose
yaml. And while I could expose80:80
/443:443
in the gluetun service config, that breaks my reverse-proxy setup (via SWAG).Is it possible to make the port configurable via environment variable? I know some other containers allow this, and it would mean that I could configure the port for speedtest to not conflict with other ports being exposed via gluetun while preserving my reverse-proxy setup.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions