Docker 1.13.1
API v1.24-1.26
When I try to update a service, I get:
{ [Error: (HTTP code 500) server error - Invalid service version '': strconv.ParseUint: parsing "": invalid syntax ]
reason: 'server error',
statusCode: 500,
json: { message: 'Invalid service version \'\': strconv.ParseUint: parsing "": invalid syntax' } }
Googled a while and found that to update a service we need to set ?vesion=x. Version number we can get from service inspect.
From docker docs:
version
integer Required
The version number of the service object being updated. This is required to avoid conflicting writes.
From dockerode service update prototype:
...
path: '/services/' + this.id + '/update?',
...
Is it bug or missed something?
Did you provide the version in the options?
Like so: https://github.com/apocas/dockerode/blob/master/test/swarm.js#L211
I had a similar issue myself.
The easiest way is to query Docker for the current service version and work from that.
Just like this test is doing: https://github.com/apocas/dockerode/blob/master/test/swarm.js#L215
I got the same problem and solved it by what @apocas said. Although it is a little puzzled that the "version" changes so quick. Anyway, thanks a lot @apocas
Most helpful comment
I had a similar issue myself.
The easiest way is to query Docker for the current service version and work from that.
Just like this test is doing: https://github.com/apocas/dockerode/blob/master/test/swarm.js#L215