Docker Community Forums

Share and learn in the Docker community.

Added haproxy service to a stack, need to free up exposed ports


(Rimmon1971) #1

Hello everybody. Let’s say I’ve started with this docker-stack.yml (relevant excerpts only)

services:
    whatever1:
        image: rimmon1971/whatever1
        deploy:
            mode: replicated
            replicas: 1
        ports:
            - 10080:80
    whatever2:
        image: rimmon1971/whatever2
        deploy:
            mode: replicated
            replicas: 1
        ports:
            - 10180:80 

And with an “upstream” reverse proxy to direct traffic to whatever1 or whatever2.
I then decided to expand the stack inserting an haproxy service published on port 10080 of the “ingress” network, moving the acl/backend rules from the upstream to the “stack-deployed” haproxy

services:
    haproxy:
        image: rimmon1971/base-alpine:haproxy
        deploy:
            mode: replicated
            replicas: 1
        ports:
            - 10080:80
    whatever1:
        image: rimmon1971/whatever1
        deploy:
            mode: replicated
            replicas: 1
        ports:
            - 80
    whatever2:
        image: rimmon1971/whatever2
        deploy:
            mode: replicated
            replicas: 1
        ports:
            - 80

docker stack deploy failed saying that port 10080 on the ingress network was in use by whatever1 service, so I had to publish haproxy with another outside port.

services:
    haproxy:
        image: rimmon1971/base-alpine:haproxy
        deploy:
            mode: replicated
            replicas: 1
        ports:
            - 10280:80
....

Now, whatever1 and whatever2 are up&running (listening to ports 10080 and 10180 on “ingress” network): how can I convince them to cease this, without resorting on

docker stack rm mystack ; docker stack deploy -c docker-stack.yml mystack

??? Thanks in advance