serve icon indicating copy to clipboard operation
serve copied to clipboard

best practice - handling port re-routing with docker images (use config.properties or just -p at image load)?

Open lessw2020 opened this issue 6 years ago • 3 comments

Hi all, We're re-routing our inference and mgt ports from the default 8080/8081 to 5050/9090 for internal reasons. However, since we are running in a docker container is it better to:

A - re-route ports in the config.properties file or B - just manually modify the ports at docker image load ala -p 5050:8080 -p 9090:8081

Since we have to expose the ports at docker load, it feels a bit redundant to have them re-routed in the config.properties (vs running /serve locally), but appreciate any input on best practice here.

Thanks very much, really impressed with the stability and performance of /serve!

lessw2020 avatar May 20 '20 03:05 lessw2020

@lessw2020 One will use the regular docker mechanisms for port handling for this case.

  1. Inside the docker container, you can use the default ports for torchserve -- 8080/8081. In case you are using config.properties file for starting torchserve, specify the port that it is running on inside the docker container. Note that when torchserve (or any other process) that runs inside a docker container, it is sandboxed and only knows about what exists inside the docker container.

  2. For the docker command launch do the port mapping like you mentioned -p 5050:8080 -p 9090:8081. The docker CLI is defines the mappings for ports and other resources like volumes for mapping the internal to external and/or vice-versa.

chauhang avatar May 23 '20 19:05 chauhang

Hi @chauhang - awesome, thanks very much for the advise here. We'll use the docker port command then to re-route. (also really appreciate how fast and responsive you and the whole team here are for TorchServe and providing clarifications and tips...great job!)

lessw2020 avatar May 23 '20 19:05 lessw2020

Closing this as query has been answered.

codinnvrends avatar Jun 10 '20 10:06 codinnvrends