How to install Portier on a remote machine

We had a task to install docker with #portainer on a remote server. Unfortunately, when you install it will lunch an installation web service on a port 9000 where you need to finish the installation.

If the installation is local or machine provides a GUI interface with a browser with javascript enabled then there is no problem. What if you want to use portainer on a remote machine without X system/mac/windows?

Best solution is to open an SSH tunnel to a server with command:

On the remote machine you start portainer like in manual:

$docker pull portainer/portainer
$docker volume create portainer_data
$docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

On your machine:

$ssh -L 9000: username@servername

Then you can easily finish installation on your own computer by navigating your favourite browser with javascript enabled to .

Once the installation is finished, the web interface would be available on port 8000. So to access it simply open a tunnel from your machine to remote by command:

$ssh -L 8000: username@servername

If you are on a windows client machine and you are using #putty client then configuration would look like this:

putty: Connection/SSH/Tunnels