Closed deviantony closed 6 years ago
This issue seems to be related to the API_VERSION. I did not found a way to set the API_VERSION used internally by the client with the libcompose
cli tool (default API_VERSION is hardcoded to "1.20", my engine is using "1.30").
When using the scale feature programmatically with a client with a correct API_VERSION, this works well.
Actually, I just reproduced this even we specifying the APIVersion. Will investigate a bit more.
It seems that there is a bug related to the ability to scale a service using libcompose.
I built libcompose using the following steps:
github.com/docker/libcompose
Now, when using the following
docker-compose.yml
file:I can execute the
up
action against the stack without any issue (note: I've enabled debugging in libcompose):And somehow, an error is raised sometimes (not all the times, I'd say 80% of time) when I try to scale a service:
First try, scale the service to 2, OK:
Second try, downscale the service to 1, KO:
Third try, scale the service to 2, OK:
Fourth try, scale the service to 3, KO:
One thing that disturbs me is that starting from the third try, it seems that libcompose lost the count of replicas inside the service. On the third try, I'm trying to scale the service to 2 replicas and it is creating a container name
myproject_service_3
(should bemyproject_service_2
). Same for the fourth try, it should be creating a container namedmyproject_service_3
and instead it is creating a container namedmyproject_service_4
.After diving a bit in the code, I'm pretty sure that the following error:
Is related to https://github.com/docker/libcompose/blob/master/docker/service/service.go#L337 and specifically to https://github.com/docker/libcompose/blob/master/docker/service/service.go#L377