Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scale counts wrong #3273

Closed
jayfk opened this issue Apr 6, 2016 · 2 comments
Closed

Scale counts wrong #3273

jayfk opened this issue Apr 6, 2016 · 2 comments

Comments

@jayfk
Copy link

jayfk commented Apr 6, 2016

The scale command begins to count at whatever value the last running container has at com.docker.compose.container-number when starting new containers.

Imagine the following: foo is scaled to 2, but foo_1 is stopped and removed. When scaling up, compose starts to create and run foo_3 instead of foo_1.


To reproduce:

version: "2"

services:
  foo:
    image: busybox
    command: sleep 300
docker-compose scale foo=2              
Creating and starting 1 ... done
Creating and starting 2 ... done
docker-compose ps  
     Name          Command    State   Ports
-------------------------------------------
increment_foo_1   sleep 300   Up
increment_foo_2   sleep 300   Up
docker stop increment_foo_1  
increment_foo_1
docker-compose ps               
     Name          Command    State    Ports
--------------------------------------------
increment_foo_1   sleep 300   Exit 0
increment_foo_2   sleep 300   Up
docker-compose rm -f    
Going to remove increment_foo_1
Removing increment_foo_1 ... done
docker-compose scale foo=2  
Creating and starting 3 ... done
docker-compose ps 
     Name          Command    State   Ports
-------------------------------------------
increment_foo_2   sleep 300   Up
increment_foo_3   sleep 300   Up
@dnephin
Copy link

dnephin commented Apr 6, 2016

This is by design. There shouldn't be any documentation that says numbers should always start at 1. These numbers are really just to give the container a unique name.

We'd actually like to remove the sequential numbers (#1516), so I don't think we're going to be doing any work to have the numbers "fill in the gaps". This would make Compose even more prone to race conditions and would be additional API calls with no real benefit.

@dnephin dnephin closed this as completed Apr 6, 2016
@jayfk
Copy link
Author

jayfk commented Apr 6, 2016

All right, that's great news!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants