Docker.DotNet icon indicating copy to clipboard operation
Docker.DotNet copied to clipboard

"orphaned" value is missing from Docker.DotNet.Models.TaskState enum

Open EugeneScully opened this issue 8 years ago • 4 comments

I have an orphaned task, and am getting the exception: Newtonsoft.Json.JsonSerializationException: Error converting value "orphaned" to type 'Docker.DotNet.Models.TaskState'. Path '[0].Status.State', line 1, position 826. ---> System.ArgumentException: Requested value 'orphaned' was not found.

The Docker Swarm documentation lists this state: https://docs.docker.com/engine/swarm/how-swarm-mode-works/swarm-task-states/

But it is not a valid value for the TaskState enum according to the API document: https://docs.docker.com/engine/api/v1.35/#operation/TaskInspect

Output of dotnet --info:

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.3
  Build    : a9190d4a75f4a982ae4b4fa8d1a24526566c69df

What version of Docker.DotNet?:

3.125.0

Steps to reproduce the issue:

  1. Have an orphaned Docker Task - I'm not sure how to create an orphaned task
  2. Call "await client.Tasks.ListAsync();"

What actually happened?: JSON deserialization exception occurs (Shown above)

What did you expect to happen?: Docker Tasks listed correctly. If I have a single orphaned task in the task list, I can't retrieve any of the tasks anymore

Additional information: None

EugeneScully avatar Jan 30 '18 05:01 EugeneScully

What daemon API are you calling this on?

jterry75 avatar Jan 30 '18 23:01 jterry75

Using the Unix socket API (unix://./var/run/docker.sock)

Dotnet standard/ASP Dotnet Core app running in a linux container

I've also filed a bug in the docker/moby project to update the api/swagger.yml file with the "orphaned" state and there's a pending pull request for the fix in that project: https://github.com/moby/moby/issues/36142 https://github.com/moby/moby/pull/36146

Note that the pull request also adds the "remove" state (as well as the "orphaned" state)

EugeneScully avatar Jan 31 '18 02:01 EugeneScully

No I mean what daemon API version are you using v1.. This is quite far behind so its possible that value didnt exist as part of v1.25

jterry75 avatar Jan 31 '18 17:01 jterry75

v1.35, but the value is not listed in the 1.35 API so upgrading to 1.35 will not fix this issue

That's why I filed a bug in the moby project: https://docs.docker.com/engine/api/v1.35/#operation/TaskInspect https://github.com/moby/moby/blob/master/api/swagger.yaml

The orphaned state looks like it has been reported by the Docker API for a while. Its possible that it was reported back in v1.24 and not in the swagger.yml, but its difficult to say without going through the Docker project history

Client:
 Version:       18.01.0-ce
 API version:   1.35
 Go version:    go1.9.2
 Git commit:    03596f5
 Built: Wed Jan 10 20:11:05 2018
 OS/Arch:       linux/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:      18.01.0-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.2
  Git commit:   03596f5
  Built:        Wed Jan 10 20:09:37 2018
  OS/Arch:      linux/amd64
  Experimental: false

EugeneScully avatar Feb 01 '18 00:02 EugeneScully