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"
}
]
}
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.
Most helpful comment
Following a discussion on Gitter, format should be:
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".