How can I register a local model.mar to a running torchserve service?
I have a running torchserve service. According to the docs, I can register a new model at port 8081 with the ManagementAPI. When running curl -X OPTIONS http://localhost:8081, the output also states for the post request on /models:
    ...
    &quot;post&quot;: {
        &quot;description&quot;: &quot;Register a new model in TorchServe.&quot;,
        &quot;operationId&quot;: &quot;registerModel&quot;,
        &quot;parameters&quot;: [
          {
            &quot;in&quot;: &quot;query&quot;,
            &quot;name&quot;: &quot;url&quot;,
            &quot;description&quot;: &quot;Model archive download url, support local file or HTTP(s) protocol. For S3, consider use pre-signed url.&quot;,
            &quot;required&quot;: true,
            &quot;schema&quot;: {
              &quot;type&quot;: &quot;string&quot;
            }
          },
     ...

Now, I do have a local model.mar file and want to use it with the file protocol. I tried:
curl -X POST &quot;http://localhost:8081/models?url=file:///path/to/model.mar&quot;

But got:
{
  &quot;code&quot;: 400,
  &quot;type&quot;: &quot;DownloadArchiveException&quot;,
  &quot;message&quot;: &quot;Failed to download archive from: file:///path/to/model.mar&quot;
}

Is there anything that I am missing? How can I properly register a local model.mar to a running torchserve service?

I just figured it out. Everything I stated was completely correct and under normal circumstances, all of this would have worked.
The error is arising because I am running the torchserve instance in a docker container and the curl command is sent to this container which then looks in his local files for the model.mar. I thought for whatever reason that I can pass a file path from the machine that the docker container is running on.
Instead, I have to copy the file into the docker container first (or mount a directory) and then execute the registering command with the file path from the model.mar inside the docker container.
