Docker image that proxies host ports to swarm services with PROXY protocol
headers, using proxyprotocol-server.
The intention is to bind to host ports and proxy connections to Docker's built-in load balancers. The services should expect a PROXY protocol header.
First, create a new service in your docker-compose.yml:
proxy:
image: icgood/proxy-protocol
deploy:
mode: globalThe mode: global configuration means the service will run a single instance
on each node.
Declare one or more host port bindings:
ports:
- target: 143
published: 143
protocol: tcp
mode: host
- target: 4190
published: 4190
protocol: tcp
mode: hostFinally, modify the service endpoint to proxy the ports to a backend service:
entrypoint: >-
proxyprotocol-server
--service :143 imap-server:143
--service :4190 imap-server:4190In the above example, another service named imap-server should be listening
on ports 143 and 4190.