Changing Portainer UI ports number

Discussion about Docker
Post Reply
User avatar
sts41
Posts: 20
Joined: 26 May 2022, 21:29

Changing Portainer UI ports number

Post by sts41 »

Just writing this for two reasons, one would be to help out after I spent many hours figuring this out since there wasn't any documentation on the Non Docker version of Portainer, and maybe get Terramaster development team to add a few things in one file to make it easier for others in the future.

This began because I have a Java applet that uses port 9443 and no easy way to change it. Portainer also uses that port for the https service. After a lot of searching, I found nothing online on how to do this. So I started looking at the startup service for Portainer in TOS 5.1.

If you look at the startup variable listed in the service (/Volume1/@apps/Portainer/init.d/service):

path=$(dirname $(readlink -f "${BASH_SOURCE[0]}"))
ThisPath=$(dirname "$path")
program="$ThisPath/portainer/portainer"
program_name=$(basename "$program")
tunnel_port=18000
program_port=19000
#program_data=$(ter_share_add -name "Portainer")
program_log=/var/log/portainer.log
proxy_file=/etc/nginx/conf.d/portainer.conf
default="$ThisPath/config/portainer.default"

There is a tunnel_port and a program_port listed, and it is easy to just change these port numbers if needed....

By simply running the executable with the help flag, I found the ports I needed:

--bind-https=:"9443" Address and port to serve Portainer via https

So by adding these to the Variable list above:

tunnel_port=18000
program_port=19000
https_port=9443

and updating the start command again in the service file:
$program --bind=":$program_port" --bind-https=:"$https_port" --tunnel-port="$tunnel_port" -d "$ThisPath" --admin-password-file="$default" > $program_log 2>&1 &


Just change the port in the variable, and restart the service and Voila....

Hope this helps someone in the future....

Steve
Post Reply

Return to “Docker”