docksal / service-vhost-proxy

Virtual host proxy service image for Docksal
http://docksal.io
MIT License
7 stars 14 forks source link

Support routing to custom container ports #20

Closed lmakarov closed 6 years ago

lmakarov commented 6 years ago

docksal-vhost-proxy only supports routing ports 80/443 on the host to ports 80/443 in containers.

In certain cases containers may have to use a different port. E.g. nodejs apps use port 3000 by default. Binding to privileged ports (80/443) requires running nodejs as root, which is not desirable.

This functionality exists in jwilder/nginx-proxy and can be borrowed from there: https://github.com/jwilder/nginx-proxy#multiple-ports

lmakarov commented 6 years ago

This is available in docksal/vhost-proxy:edge and will be release in the next release (by end of month).

Example nodejs project utilizing this feature: https://github.com/docksal/example-nodejs

Example standalone nodejs container:

fin docker run -d --name=nodejs \
    -v $(pwd):/app \
    --label=io.docksal.virtual-host=nodejs.docksal \
    --label=io.docksal.virtual-port=3000 \
    --expose 3000 \
    node:alpine \
    node /app/index.js