Portainer: Add host port to templates.json

Created on 8 Apr 2017  ·  3Comments  ·  Source: portainer/portainer

What do you think to implement the ability of defining the host port to attach to the container port straight from the templates.json ?

So we can show it within the dashboard and define the hsot value as a placeholder.

I suggest to go from that structure :

{
    "ports": [
      "80/tcp"
    ]
}

to

 {
    "ports": [
      {
        "host": "2222",
        "container": "22/tcp"
      }
    ]
  }
aretemplates kinenhancement

Most helpful comment

Following a discussion on Gitter, format should be:

"ports": [
   {
     "container": 22,
     "host": 8080, //optional, let Docker assign the port if not specified
     "protocol": "tcp|udp" //optional, defaults to tcp
   }
]

I'd like to have an extra warning specified here when the port on the host is specified. Something like "This template is publishing a specific port on the host, you will not be able to deploy it multiple times without changing the port in the advanced settings".

All 3 comments

Following a discussion on Gitter, format should be:

"ports": [
   {
     "container": 22,
     "host": 8080, //optional, let Docker assign the port if not specified
     "protocol": "tcp|udp" //optional, defaults to tcp
   }
]

I'd like to have an extra warning specified here when the port on the host is specified. Something like "This template is publishing a specific port on the host, you will not be able to deploy it multiple times without changing the port in the advanced settings".

I'd really love to see this, as it would allow our templates to use bridge mode without counting on people to expand the hidden mapping UI to map things straight through (in our case) rather then getting random ports. For now we use host mode just because of this, but that doesn't seem to allow for network stats in Portainer.

Thanks for considering this!

I'd accept a PR for this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FabianTe picture FabianTe  ·  3Comments

aprcloud picture aprcloud  ·  3Comments

chrisvanderpennen picture chrisvanderpennen  ·  3Comments

cbrherms picture cbrherms  ·  3Comments

himred picture himred  ·  3Comments