51. Docker Port Publishing Mode

Опубликовано: 25 Февраль 2025
на канале: iMustLearn
39
0

Types of port publishing modes:
==============================
1. Ingress
2. Host

##Ingress:
----------
The default mode.
Publishes the port on all hosts i.e. all nodes of a swarm cluster . Routing mesh.
Create a service using ingress publishing port:
docker service create name mynginx p 8080:80 nginx

##Host:
--------
Publishes the port on host where containers are running.
Runs only one task of a service on the same node.
Create a service using host publishing port
docker service create name mynginxhost p mode= host,published =8081,target=80 nginx

ReferenceDoc:
https://docs.docker.com/engine/swarm/...