Image/Container not working as service

Hi All,
I am new to docker world. I am facing an issue. With my own image or from docker hub like (visualizer) etc. When i run the image as standalone container it works fine and i am able to access the application. But when i run it as service “docker stack deploy -c docker-compose.yml getstartedlab” i.e https://docs.docker.com/get-started/part3 . The browser keeps on loading and never loads the application . I have no clue whats happening. May be some ports / network issue of docker?
My sample YAML file
version: "3"
services:
web:
visualizer:
image: dockersamples/visualizer:stable
ports:
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
placement:
constraints: [node.role == manager]
networks:
- webnet
networks:
webnet:

Any one please suggest what’s wrong?