I am using docker service api to scale the number of replicas, however it is returning an error related to version, I tried to pass the version which was returned in the service inspect api, it didn’t help getting the same error message. Anyone has luck with service update api to scale the number of containers.
instead of curl -v -XPOST http://:2375/services/SERVICE-ID/update -d @service-update.json shouldn’t it be curl -v -XPOST http://:2375/v1.24/services/SERVICE-ID/update -d @service-update.json if you want to use v1.24, which is the latest version for Docker 1.12.0
Adding v1.24 to the URL didn’t help me out. getting the same error message.
But adding version as the query parameters, raised different error.
{“message”:“rpc error: code = 2 desc = update out of sequence”}
What will be significance of version parameter. Do we need to check the version parameter of service that we are trying to update. I have tried using the version parameter from service inspect command and it worked fine.
docker service inspect SERVICE-ID
“Version”: {
“Index”: 97891
}
Where did it specified that we need to use version parameters from inspect as a query parameter for Update API. can you please point to the documentation. I couldn’t able to find the API documentation.
But adding version=VERSION_FROM_INSPECT_SERVICE has worked fine. I have received 200 OK response back.
Update API is not retaining any environment variables or container labels, which were passed during service creation. It looks like we need to send all these parameters again with service update API.
I have used the above request json file to send for the update api command, it removed all the existing environment variables, container labels, service labels which I have used during the service creation part. Are you guys also facing the same issue. Is there any way that I can inform update API to not to remove any existing information. Currently my usecase is I want to scale up the service using update API command.