How does Kitematic choose the "view in web browser" port?

Hello,

How does Kitematic choose which port to show as “view in browser”?
I noticed that the Ghost docker image has a “View in browser” option but it is not doing anything special in the Dockerfile: https://github.com/dockerfile/ghost/blob/master/Dockerfile#L37

In my case I have EXPOSE for 3 ports and the view option is not available: http://v14d.com/i/553fcbeb792df.png

1 Like

Thanks for posting!

Very sorry for the late reply. We show web preview for these ports: [‘80’, ‘8000’, ‘8080’, ‘3000’, ‘5000’, ‘2368’, ‘9200’, ‘8983’]

We should probably figure out a dynamic way to do this - any suggestions? Which port are you exposing?

1 Like

Thanks for the answer.

I’m using port 3030 but can probably change that.

a dynamic way to do this - any suggestions?

The app can maybe access each exposed port and see which one returns html content. If there are more than one then it can provide multiple buttons or something.

1 Like

Multiple web previews would be very nice.

I’d really love to see a “WEB_PREVIEW” environment variable for this setting.

In my own case, I’ve got the reverse proxy running jwilder/nginx-proxy which I use to assign multiple web-containers to different host names. Being able to add “WEB_PREVIEW” url as an environment variable would be helpful.

1 Like

Yes, having an env variable, such as WEB_PREVIEW would be great. Not only for ports configuration, but also for paths other than ‘/’.

1 Like