Assumption
I have torchserve installed and running inside a WSL2 Docker container that makes an API for the Pytorch model.
What I would like to achieve.
I would like to receive a list of models when I run the curl command.
curl http://127.0.0.1:8081/models
Expected Results
{
"models": [
{
"modelName": "densenet161",
"modelUrl": "densenet161.mar"
}
]
}
Occurring problems
The following message is returned.
<HTML>
<HEAD><TITLE>Redirection</TITLE></HEAD>
<BODY><H1>Redirect</H1></BODY>
What I tried
The following commands were executed from the Torchserve container
curl 127.0.0.1:8081/models
I tried with the IP address of the Docker container (172.17.0.5) but it returned an error.
curl 172.17.0.5:8081/models
curl: (52) Empty reply from server
When running the Docker container, I did the following port forwarding. I ran the curl command from host to host IP address with the same result.
docker run -it --gpus all -v /home:/home -p 8080:8080 -p 8081:8081 -p 8082:8082 --shm-size 8GB ts_test
curl http://172.19.108.214:8081/models
With the -L option, an error was returned with the following results.
root@f0b48fd29ec1:~# curl -L http://127.0.0.1:8081/models
curl: (52) Empty reply from server
With the -v option, the following results were returned.
root@f0b48fd29ec1:~# curl -v http://127.0.0.1:8081/models
* Trying 10.77.8.70...
* TCP_NODELAY set
* Connected to proxy.mei.co.jp (10.77.8.70) port 8080 (#0)
> GET http://127.0.0.1:8081/models HTTP/1.1
> Host: 127.0.0.1:8081
> User-Agent: curl/7.58.0
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 301 Moved Permanently
< Server: BlueCoat-Security-Appliance
< Location:http://10.75.28.231
< Connection: Close
<
<HTML>
<HEAD><TITLE>Redirection</TITLE></HEAD>
<BODY><H1>Redirect</H1></BODY>
* Closing connection 0
What are some possible reasons why the curl command is not returning results?
curl -L http://127.0.0.1:8081/models?@Takayama-Shin you should login into the container.lsof -i:8081to check the process listening on this port 8081 or not.