Docker Community Forums

Share and learn in the Docker community.

Get Started Load balancing App


(Jackchuong) #1

Hi all,
I’m newbie with Docker , I read article at “https://docs.docker.com/get-started/part3/” , this is my docker-compose.yml
version: “3”
services:
web:
# replace username/repo:tag with your name and image details
image: jackchuong/get-started:part2
deploy:
replicas: 2
resources:
limits:
cpus: “0.1”
memory: 50M
restart_policy:
condition: on-failure
ports:
- “4000:1234”
networks:
- webnet
networks:
webnet:
The command “docker stack deploy -c docker-compose.yml getstartedlab” work fine.
docker service ls
w05cf1dyofug getstartedlab_web replicated 2/2 jackchuong/get-started:part2 *:4000->1234/tcp
docker service ps getstartedlab_web
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
iimw6kdnex3v getstartedlab_web.1 jackchuong/get-started:part2 gitlab Running Running 11 minutes ago
9nf2y8wquxn3 getstartedlab_web.2 jackchuong/get-started:part2 gitlab Running Running 11 minutes ago
But there is not tcp service listen on port 1234 so I cannot access localhost:1234 , access localhost:4000 still show result
Hello World!
Hostname: 64b676a0eb33
Visits: cannot connect to Redis, counter disabled
Did I misunderstand it or I did something work ?