virtualzone/docker-container-stats

Port forwarding isn't happening from server to local system.

anubhav0fnu opened this issue · 1 comments

I'm running your container on my company's server and collected stats

CONTAINER ID        IMAGE                                COMMAND                  CREATED             STATUS                  PORTS                    NAMES
4b1084619ef2        virtualzone/docker-container-stats   "/usr/bin/supervisord"   4 days ago          Up 4 days               0.0.0.0:8080->8080/tcp   stats

In order to watch it on my local computer, I did remote port forwarding.

ssh <ssh server> -R [SSH Server IP to Bind To]:[SSH Server Port to Bind To]:[Target Destination]:[Target Port]

Eg.

ssh user_name@server_name.company.org -R 0.0.0.0:8080:127.0.0.1:80

I was able to successfully ssh into the server(REDHAT)
Later, using this, I checked the port-forwarding. I got affirmation:

2020/08/14 19:40:55 socat[11927] E bind(5, {AF=2 0.0.0.0:80}, 16): Address already in use

But still, on my local system browser, I can access the web-interface(https://127.0.0.1:80/), browser say's This site can’t be reached127.0.0.1 refused to connect.

  • do you know what's going on wrong here?
  • Is there a way to transfer the stored stats locally and run the setup locally to visualize the historical stats?

Found a solution
On the server, your packets are going to localhost:8080
assuming following the instruction in README.md

$docker ps -a
4b1084619ef2        virtualzone/docker-container-stats   "/usr/bin/supervisord"   7 days ago          Up 7 days               0.0.0.0:8080->8080/tcp   stats

Just to check on the server with sudo access:

$lsof -i :8080
docker-pr 30237 root    4u  IPv4 65764576      0t0  TCP *:webcache (LISTEN)

The on the local machine:

ssh -N -f -L localhost:8080:localhost:8080 remote_user@remote_host

You would be able to see it in your browser: http://localhost:8080/
https://imgur.com/a/Dkll83C