'Ports binding not applied to containers from Docker Swarm service

I am running my application in Docker swarm mode in a single host with only one node (Manager). The application has two services and docker stack is deployed using my docker-compose file (using local images, i.e. not pulled from a remote registry)

When I deploy the docker stack, I get the services running according to port binding in the docker-compose file, as shown below

On docker service ls, enter image description here

But when I inspect the services in the stack (backend_stack_ai_tms), the port binding is not getting shown,

On docker service ps backend_stack_ai_tms, enter image description here

Also, port binding is not present for the containers. Due to this, I am not able to access the containers from my host.

On docker ps, enter image description here

How to achieve the port binding for the containers so that I can access from the host?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source