Exception thrown when trying to do a Test Feed on an external docker container registry feed

I am trying to test an external feed to a Docker Container Registry using the Octopus Deploy Test Feed page. I get an error no matter what values I enter for the Package name. I’ve tried the actual package name (with and without a tag) and simple values like ‘abc’. They all produce the exception ‘Unexpected character encountered while parsing value: <. Path ‘’, line 1, position 1’

I have verified that the package is in the registry and can be pulled via a powershell docker pull command.

Note: using Octopus Deploy 3.7.10.



Package name
dn/hdata-fds
×
Unexpected character encountered while parsing value: <. Path ‘’, line 1, position 1.
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path ‘’, line 1, position 1.
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
at Octopus.Core.Packages.Docker.DockerRegistryV2ImageFeed.GetPackagesContaining(String searchTerm, Int32& total, Int32 skip, Int32 take, Boolean allowPreRelease) in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Core\Packages\Docker\DockerRegistryV2ImageFeed.cs:line 124
at Octopus.Server.Web.Api.Actions.PackageSearchAction.Search(String feedId, String packageId, Boolean partialMatch, Boolean includeMultipleVersions, Boolean includeNotes, Boolean includePreRelease, Int32 take, VersionRange versionRange, Regex preReleaseTag) in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Web\Api\Actions\PackageSearchAction.cs:line 73
at Octopus.Server.Web.Api.Actions.PackageSearchAction.Execute() in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Web\Api\Actions\PackageSearchAction.cs:line 53
at Octopus.Server.Web.Infrastructure.Api.Responder`1.Respond(TDescriptor options, NancyContext context) in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Web\Infrastructure\Api\Responder.cs:line 145
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at Octopus.Server.Web.Api.OctopusRestApiModule.<>c__DisplayClass0_0.<.ctor>b__0(Object o) in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Web\Api\OctopusRestApiModule.cs:line 46
at Nancy.Routing.Route.<>c__DisplayClass4.b__3(Object parameters, CancellationToken context)

Hi,

Thanks for getting in touch!

Could you open the developer tools of your browser and look at the network tab and check what the response from the test call is? It looks suspiciously like it is being returned HTML instead of the expected JSON which could happen if an error occurred when calling the Docker Container Registry.

Thank you and best regards,
Henrik

Hi Henrik,

Here is the responses of the call just before the error and the error response:

REQUEST HEADER:
GET /api/feeds/feeds-azure-data-network-repository HTTP/1.1
Host: localhost
Connection: keep-alive
Accept: application/json
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
Referer: http://localhost/app
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: en-US,en;q=0.8
Cookie: OctopusIdentificationToken_cb49f65d-c604-426b-9ef6-03996e90d694=9ezFhmq1oil%2bNcW3wzn%2ffQfQ3A5qltpAvn6xvFglbGj6EBJpCrPSrvMLtRkZf6eECqyIcW2ffrsNlsd3QaIth3fkYg6kYak4nAPlx1u0mOV8u8XMgSM7MuE0bYyDGvW6MIFALVQktT1nutIxnRr%2bnzYCTjKNJHZgEVdQXtiJ0kuaCXCnYY%2bG1C4i%2bnuhaAp2MGMReBqoZDG28LiNdNWFsKdAhghmOU5ZlxTw9RkLr%2bvhx849%2fgCEMA4Fxgzte6fE%7cob%2f%2b5awc%2f8gEiFk%2b0PThcQ%3d%3d

RESPONSE HEADER:
HTTP/1.1 200 OK
Cache-Control: no-cache
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Content-Encoding: gzip
Expires: Tue, 27 Dec 2016 16:41:00 GMT
Server: Octopus Deploy/ Microsoft-HTTPAPI/2.0
X-UA-Compatible: IE=edge
X-Frame-Options: DENY
Date: Wed, 28 Dec 2016 16:40:59 GMT

RESPONSE:
{
“FeedType”: “Docker”,
“ApiVersion”: “v2”,
“RegistryPath”: “”,
“Name”: “Azure Data Network repository”,
“FeedUri”: “http://tsdatanetwork-on.azurecr.io”,
“Username”: “tsdatanetwork”,
“Password”: {
“HasValue”: true,
“NewValue”: null
},
“Id”: “feeds-azure-data-network-repository”,
“LastModifiedOn”: null,
“LastModifiedBy”: null,
“Links”: {
“Self”: “/api/feeds/feeds-azure-data-network-repository”,
“Packages”: “/api/feeds/feeds-azure-data-network-repository/packages”,
“SearchTemplate”: “/api/feeds/feeds-azure-data-network-repository/packages{?packageId,partialMatch,includeMultipleVersions,includeNotes,includePreRelease,versionRange,preReleaseTag,take}”,
“VersionsTemplate”: “/api/feeds/feeds-azure-data-network-repository/packages{?packageIds}”,
“NotesTemplate”: “/api/feeds/feeds-azure-data-network-repository/packages/notes{?packageId,version}”
}
}

REQUEST HEADER:
GET /api/feeds/feeds-azure-data-network-repository/packages?packageId=dn%2Fhdata-fds&partialMatch=false&includeMultipleVersions=false&includeNotes=false&includePreRelease=false&take=1 HTTP/1.1
Host: localhost
Connection: keep-alive
Accept: application/json
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
Referer: http://localhost/app
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: en-US,en;q=0.8
Cookie: OctopusIdentificationToken_cb49f65d-c604-426b-9ef6-03996e90d694=9ezFhmq1oil%2bNcW3wzn%2ffQfQ3A5qltpAvn6xvFglbGj6EBJpCrPSrvMLtRkZf6eECqyIcW2ffrsNlsd3QaIth3fkYg6kYak4nAPlx1u0mOV8u8XMgSM7MuE0bYyDGvW6MIFALVQktT1nutIxnRr%2bnzYCTjKNJHZgEVdQXtiJ0kuaCXCnYY%2bG1C4i%2bnuhaAp2MGMReBqoZDG28LiNdNWFsKdAhghmOU5ZlxTw9RkLr%2bvhx849%2fgCEMA4Fxgzte6fE%7cob%2f%2b5awc%2f8gEiFk%2b0PThcQ%3d%3d

RESPONSE HEADER:
HTTP/1.1 500 Internal Server Error
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
X-Frame-Options: DENY
Date: Wed, 28 Dec 2016 16:41:01 GMT

RESPONSE:
{
“ErrorMessage”: “Unexpected character encountered while parsing value: <. Path ‘’, line 1, position 1.”,
“FullException”: “Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path ‘’, line 1, position 1.\r\n at Newtonsoft.Json.JsonTextReader.ParseValue()\r\n at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)\r\n at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)\r\n at Octopus.Core.Packages.Docker.DockerRegistryV2ImageFeed.GetVersions(String packageId, Int32 skip, Int32 take, Boolean allowPreRelease, Func2 filter) in Z:\\buildAgent\\workDir\\eec88466c176b607\\source\\Octopus.Core\\Packages\\Docker\\DockerRegistryV2ImageFeed.cs:line 79\r\n at Octopus.Server.Web.Api.Actions.PackageSearchAction.Search(String feedId, String packageId, Boolean partialMatch, Boolean includeMultipleVersions, Boolean includeNotes, Boolean includePreRelease, Int32 take, VersionRange versionRange, Regex preReleaseTag) in Z:\\buildAgent\\workDir\\eec88466c176b607\\source\\Octopus.Server\\Web\\Api\\Actions\\PackageSearchAction.cs:line 68\r\n at Octopus.Server.Web.Api.Actions.PackageSearchAction.Execute() in Z:\\buildAgent\\workDir\\eec88466c176b607\\source\\Octopus.Server\\Web\\Api\\Actions\\PackageSearchAction.cs:line 53\r\n at Octopus.Server.Web.Infrastructure.Api.Responder1.Respond(TDescriptor options, NancyContext context) in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Web\Infrastructure\Api\Responder.cs:line 145\r\n at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)\r\n at Octopus.Server.Web.Api.OctopusRestApiModule.<>c__DisplayClass0_0.<.ctor>b__0(Object o) in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Web\Api\OctopusRestApiModule.cs:line 46\r\n at Nancy.Routing.Route.<>c__DisplayClass4.b__3(Object parameters, CancellationToken context)”
}

Hi,

I’m sorry to say this, but I’m not sure why it is not working for you so I’m going to have to have a chat with the team when they’re all back from the Christmas/New Years break.

I’ll be in contact as soon as I can next week.

Thank you and best regards,
Henrik

Hi again,

We had another customer that were having issues with their Docker registry feed and it came down to that the URL they had entered for their registry was missing one vital piece, v2 at the end of the URL, i.e. http://url.to.registry/v2. By the looks of things, you haven’t specified that in your URL either, could I get you to add that and try again?

Thank you and best regards,
Henrik

Actually, I setup an Azure Container Registry (ACR) to test this myself and it looks like ACR doesn’t expose the same REST API endpoints that we are using when calling the registry to find images. I haven’t been able to find any documentation either that tells us how one would access the REST API (if it even exposes one).

So for now, I’m afraid that I don’t think ACR will work with Octopus. I’ll still have a chat to the team next week and see if we can figure out a way to support ACR.

Thank you and warm regards,
Henrik

Thanks for the reply. I’ll work around it for now.

Hi,

I’ve raised this issue to have this investigated as it used to work when we initially implemented the Docker support.

Thank you and warm regards,
Henrik

Hi,
Taking a look at your error message it appears that you may have configured the wrong registry address. Instead of http://tsdatanetwork-on.azurecr.io, could you instead use https and include the path /v2*. In your case your feed should end up something likehttps://tsdatanetwork-on.azurecr.io/v2`.
Our documentation site is currently undergoing maintenance but I will be sure to add more information regarding these requirements once it is available for update again.

Please try again using this updated url and let me know if you experience any further issues.
Cheers,
Rob