I have a swarm created by two nodes, one manager and one worker. I would like to have a port published in the swarm, so I can access my applications, and I wonder how I achieve this.
version: '2' services: server: build: . image: my-hub.company.com/application/server:latest ports: - "80:80"
This provides port 80 when I start docker build and it works fine, however when I start batch deployment
docker deploy my-service
This will not publish the port, so it just says 80 / tcp in docker ps instead of pointing to the port. Perhaps this is due to the fact that I need to connect a load balancer or run some bizarre command, or maybe add another configuration level to actually expose this port as multiple hosts.
Can someone help me figure out what I need to configure / do so that this displays the port.
My best case scenario would be that port 80 opens, and if I access it from different host names, it will send me to different applications.
Update: It seems to work if I run the following commands after deploying the application
docker service update -p 80:80 my-service_server docker kill <my-service_server id>
I found this repository to start the HA proxy, it seems to be excellent and is supported by the docker itself, however I cannot use this separate section for my services using the new swarm mode.
https://github.com/docker/dockercloud-haproxy
Below is described what the network should look like:
Internet -> HAProxy -> Service_A -> Container A
However, I canβt find a way to connect the services using the create docker create command, now it optimally looks like a way to configure the network, and when I apply this network to the service, it will select it in HAProxy.
- Marcus