
It is necessary only to define this array if you are using HOST networking and no port mappings are specified. PortDefinitions: The portDefinitions array is used to define ports that should be considered as part of a resource offer. Only one of ports and portDefinitions should be defined for an application. It is necessary only if no port mappings are specified. Ports: The ports array is used to define ports that should be considered as part of a resource offer in HOST mode. This allows containers to be deployed on USER networks that include containerPort and discovery information, but do NOT expose those ports on the host network (and by implication would not consume host port resources). In Docker USER mode the semantic for hostPort slightly changes: hostPort is not required for USER mode and if left unspecified Marathon WILL NOT automatically allocate one at random. Multiple port mappings may be specified for a Marathon application an unspecified hostPort defaults to 0 (meaning that Marathon will assign one at random). A port mapping is a tuple containing a host port, container port, service port and protocol. PortMapping: In Docker BRIDGE mode, a port mapping is necessary for every port that should be reachable from outside of your container. In this mode, applications bind directly to one or more ports on the host machine. HOST networking: used by non-Docker Marathon applications and Docker applications that use HOST mode networking. In the Mesos world such networks are often made accessible via CNI plugins used in concert with a Mesos CNI network isolator. USER network mode is expected to be useful when integrating with “user-defined” Docker networks. In this mode, applications bind to the specified ports within the container and Docker networking binds to the specified ports on the host. In this mode, container ports (a port within the container) are mapped to host ports (a port on the host machine).

USER networking: used by Docker applications that specify USER mode networking. Note that only host ports are made available to a task through environment variables.īRIDGE networking: used by Docker applications that specify BRIDGE mode networking. In HOST networking, requested ports are host ports by default. When used with BRIDGE or USER mode networking, you specify a port mapping from a host port to a container port. HostPort: A host port specifies a port on the host to bind to. This is only necessary as part of a port mapping when using BRIDGE or USER mode networking with a Docker container. DefinitionsĬontainerPort: A container port specifies a port within a container. VIPs map traffic from a single virtual address to multiple IP addresses and ports. VIPs simplify inter-app communication and implement a reliable service-oriented architecture. If you are running Marathon within a DC/OS cluster you can use virtual addresses (VIPs) to make ports management easier. This page attempts to explain more clearly how they work. Port configuration for applications in Marathon can be confusing and there is an outstanding issue to redesign the ports API. Deprecated fields may be removed in a future Marathon release.

Use this deprecated API at your own risk. Several fields of the ports API have been deprecated with Marathon v1.5 in favor of the updated (networking.html). Migrating Tools to the 1.5 Networking APIĮrror Using HTTPS with local CA Certificate Stateful Applications Using External Persistent Volumes mode: host for publishing a host port on each node, or ingress for a swarm mode port to be load balanced.Stateful Applications Using Local Persistent Volumes.protocol: the port protocol (tcp or udp).ports : - target : 80 published : 8080 protocol : tcp mode : host That can’t be expressed in the short form. There is also the long format syntax which allows additional fields to be specified Your host, for example if you run a docker run command, the thing that will runĪs a result of that command is the container. The container is what is running on top of The host is the operating system in which the Docker client is running. If you’re using docker compose the pattern is HOST:CONTAINER, for example “3000:80” Over what is exposed and allow specify specific ports to allow to be accessed. These handy mappings can give you control

Docker allows you to map ports to what is available (exposed) to the host and
