0

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?

3
  • have you tried curl -L http://127.0.0.1:8081/models?@Takayama-Shin you should login into the container. Commented Aug 25, 2022 at 7:42
  • @Dolphin Thank you for your reply. I logged into the container and ran the command, but it returned an error. > root@f0b48fd29ec1:~# curl -L 127.0.0.1:8081/models > curl: (52) Empty reply from server Commented Aug 25, 2022 at 7:55
  • using lsof -i:8081 to check the process listening on this port 8081 or not. Commented Aug 25, 2022 at 8:37

1 Answer 1

0

The following commands produced the expected results. It seems that the proxy was affecting the results.

root@f0b48fd29ec1:~/torchserve-sample# curl http://127.0.0.1:8081/models --noproxy "*"
{
  "models": [
    {
      "modelName": "densenet161",
      "modelUrl": "densenet161.mar"
    }
  ]
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.