Dockerode: Service update not work

Created on 15 Feb 2017  路  3Comments  路  Source: apocas/dockerode

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?

question

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

All 3 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peterpetre picture peterpetre  路  6Comments

lakindu95 picture lakindu95  路  3Comments

knight42 picture knight42  路  6Comments

IniZio picture IniZio  路  3Comments

knight42 picture knight42  路  7Comments