{"action":"created","issue":{"url":"https://api.github.com/repos/tsuru/tsuru/issues/1153","labels_url":"https://api.github.com/repos/tsuru/tsuru/issues/1153/labels{/name}","comments_url":"https://api.github.com/repos/tsuru/tsuru/issues/1153/comments","events_url":"https://api.github.com/repos/tsuru/tsuru/issues/1153/events","html_url":"https://github.com/tsuru/tsuru/issues/1153","id":64819098,"number":1153,"title":"unit-remove is removing wrong docker container","user":{"login":"mwduarte","id":11379721,"avatar_url":"https://avatars.githubusercontent.com/u/11379721?v=3","gravatar_id":"","url":"https://api.github.com/users/mwduarte","html_url":"https://github.com/mwduarte","followers_url":"https://api.github.com/users/mwduarte/followers","following_url":"https://api.github.com/users/mwduarte/following{/other_user}","gists_url":"https://api.github.com/users/mwduarte/gists{/gist_id}","starred_url":"https://api.github.com/users/mwduarte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwduarte/subscriptions","organizations_url":"https://api.github.com/users/mwduarte/orgs","repos_url":"https://api.github.com/users/mwduarte/repos","events_url":"https://api.github.com/users/mwduarte/events{/privacy}","received_events_url":"https://api.github.com/users/mwduarte/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-27T18:04:39Z","updated_at":"2015-03-27T18:13:23Z","closed_at":null,"body":"Hi tsuru team, first off all, i would like to congrats you for the grates job you are doing with tsuru.\r\n\r\nI'm testing 0.10.3 tsr version with 015.2 client version for 1 week ann the only issue I hit is when I run \"tsuru unit-remove\" and tsuru removes wrong container Id, bellow I detail this issue.\r\n\r\nit seems your code is getting wrong docker ID or a random one.\r\n\r\nI didn't find one issue direct related to this problem but I saw you heave a brunch identified \"unit-remove\", is this related to this problem?\r\n\r\nLet me know if you need more pieces of information about this.  \r\n\r\nThanks, regards.\r\n\r\n\r\n```\r\nmilton_duarte@ts:~/tsuru-dashboard$ /usr/bin/tsr version\r\ntsr version 0.10.3.\r\n```\r\n\r\ntsuru.conf:\r\n```\r\nmilton_duarte@ts:~/tsuru-dashboard$ cat /etc/tsuru/tsuru.conf\r\nlisten: \"0.0.0.0:8080\"\r\nhost: http://10.0.2.5:8080\r\ndebug: true\r\nadmin-team: admin\r\n\r\ndatabase:\r\n  url: 127.0.0.1:27017\r\n  name: tsurudb\r\n\r\ngit:\r\n  unit-repo: /home/application/current\r\n  api-server: http://127.0.0.1:8000\r\n\r\nauth:\r\n  user-registration: true\r\n  scheme: native\r\n\r\nrepo-manager: gandalf\r\nprovisioner: docker\r\n\r\nrouters:\r\n  hipache1:\r\n    type: hipache\r\n    domain: paas.rbs.com.br\r\n    redis-server: localhost:6379\r\n\r\nqueue: redis\r\nredis-queue:\r\n  host: localhost\r\n  port: 6379\r\n\r\ndocker:\r\n  collection: docker_containers\r\n  registry: 10.0.2.5:3030\r\n  repository-namespace: tsuru\r\n  router: hipache1\r\n  deploy-cmd: /var/lib/tsuru/deploy\r\n  segregate: true\r\n  cluster:\r\n    storage: mongodb\r\n    mongo-url: 127.0.0.1:27017\r\n    mongo-database: dockercluster\r\n  run-cmd:\r\n    bin: /var/lib/tsuru/start\r\n    port: \"8888\"\r\n  ssh:\r\n    add-key-cmd: /var/lib/tsuru/add-key\r\n    user: ubuntu\r\n```\r\n```\r\nmilton_duarte@ts:~/tsuru-dashboard$ tsuru version\r\ntsuru version 0.15.2.\r\n```\r\n```\r\nmilton_duarte@ts:~/tsuru-dashboard$ tsuru app-list\r\n+-----------------+-------------------------+---------------------------------+\r\n| Application     | Units State Summary     | Address                         |\r\n+-----------------+-------------------------+---------------------------------+\r\n| blog            | 1 of 1 units in-service | blog.paas.rbs.com.br            |\r\n+-----------------+-------------------------+---------------------------------+\r\n| teste-andre     | 2 of 2 units in-service | teste-andre.paas.rbs.com.br     |\r\n+-----------------+-------------------------+---------------------------------+\r\n| tsuru-dashboard | 1 of 1 units in-service | tsuru-dashboard.paas.rbs.com.br |\r\n+-----------------+-------------------------+---------------------------------+\r\n```\r\n```\r\nCONTAINER ID        IMAGE                                        COMMAND                CREATED             STATUS              PORTS                     NAMES\r\n1fc403394f6b        10.0.2.5:3030/tsuru/app-blog:v3              \"/bin/bash -lc 'tsur   2 hours ago         Up 2 hours          0.0.0.0:49194->8888/tcp   2107930c469a236f7878   \r\nf7ee55a888f7        10.0.2.5:3030/tsuru/app-tsuru-dashboard:v9   \"/bin/bash -lc 'tsur   2 hours ago         Up 2 hours          0.0.0.0:49193->8888/tcp   1a7744e20f8f78f173f1   \r\n3cb8dc472e79        10.0.2.5:3030/tsuru/app-teste-andre:v5       \"/bin/bash -lc 'tsur   2 hours ago         Up 2 hours          0.0.0.0:49192->8888/tcp   83b88e94aaa5978c90fc   \r\n946d0f24cad7        10.0.2.5:3030/tsuru/app-teste-andre:v5       \"/bin/bash -lc 'tsur   2 hours ago         Up 2 hours          0.0.0.0:49191->8888/tcp   798ccc8f5d1735b4e930  \r\n```\r\n```\r\nmilton_duarte@ts:~/tsuru-dashboard$ tsuru app-info -a blog\r\nApplication: blog\r\nRepository: git@10.170.92.43.nip.io:blog.git\r\nPlatform: php\r\nTeams: devops-rbs\r\nAddress: blog.paas.rbs.com.br\r\nOwner: milton.duarte@gruporbs.com.br\r\nTeam owner: devops-rbs\r\nDeploys: 3\r\nUnits: 1\r\n+------------+---------+-----------+-------+-------------+\r\n| Unit       | State   | Host      | Port  | IP          |\r\n+------------+---------+-----------+-------+-------------+\r\n| 1fc403394f | started | 127.0.0.1 | 49194 | 172.17.0.67 |\r\n+------------+---------+-----------+-------+-------------+\r\n\r\nApp Plan:\r\n+---------------+--------+------+-----------+--------+---------+\r\n| Name          | Memory | Swap | Cpu Share | Router | Default |\r\n+---------------+--------+------+-----------+--------+---------+\r\n| autogenerated | 0 MB   | 0 MB | 100       |        | false   |\r\n+---------------+--------+------+-----------+--------+---------+\r\n```\r\n```\r\nmilton_duarte@ts:~/tsuru-dashboard$ tsuru app-info -a teste-andre\r\nApplication: teste-andre\r\nRepository: git@10.170.92.43.nip.io:teste-andre.git\r\nPlatform: php\r\nTeams: devops-rbs\r\nAddress: teste-andre.paas.rbs.com.br\r\nOwner: andre.trevisani@gruporbs.com.br\r\nTeam owner: devops-rbs\r\nDeploys: 7\r\nUnits: 2\r\n+------------+---------+-----------+-------+-------------+\r\n| Unit       | State   | Host      | Port  | IP          |\r\n+------------+---------+-----------+-------+-------------+\r\n| 946d0f24ca | started | 127.0.0.1 | 49191 | 172.17.0.60 |\r\n| 3cb8dc472e | started | 127.0.0.1 | 49192 | 172.17.0.61 |\r\n+------------+---------+-----------+-------+-------------+\r\n\r\nApp Plan:\r\n+---------------+--------+------+-----------+--------+---------+\r\n| Name          | Memory | Swap | Cpu Share | Router | Default |\r\n+---------------+--------+------+-----------+--------+---------+\r\n| autogenerated | 0 MB   | 0 MB | 100       |        | false   |\r\n+---------------+--------+------+-----------+--------+---------+\r\n```\r\n```\r\nmilton_duarte@ts:~/tsuru-dashboard$ tsuru app-info -a tsuru-dashboard\r\nApplication: tsuru-dashboard\r\nRepository: git@10.170.92.43.nip.io:tsuru-dashboard.git\r\nPlatform: python\r\nTeams: admin\r\nAddress: tsuru-dashboard.paas.rbs.com.br\r\nOwner: admin@example.com\r\nTeam owner: admin\r\nDeploys: 7\r\nUnits: 1\r\n+------------+---------+-----------+-------+-------------+\r\n| Unit       | State   | Host      | Port  | IP          |\r\n+------------+---------+-----------+-------+-------------+\r\n| f7ee55a888 | started | 127.0.0.1 | 49193 | 172.17.0.64 |\r\n+------------+---------+-----------+-------+-------------+\r\n\r\nApp Plan:\r\n+---------------+--------+------+-----------+--------+---------+\r\n| Name          | Memory | Swap | Cpu Share | Router | Default |\r\n+---------------+--------+------+-----------+--------+---------+\r\n| autogenerated | 0 MB   | 0 MB | 100       |        | false   |\r\n+---------------+--------+------+-----------+--------+---------+\r\n\r\n```\r\n```\r\nmilton_duarte@ts:~/tsuru-dashboard$ tsuru unit-add 3 -a teste-andre\r\n\r\n---- Starting 3 new units ----\r\n ---> Started unit 70dffc323b...\r\n ---> Started unit 1bda4cbc46...\r\n ---> Started unit cd00afcaed...\r\n\r\n---- Binding and checking 3 new units ----\r\n ---> Bound and checked unit 70dffc323b\r\n ---> Bound and checked unit cd00afcaed\r\n ---> Bound and checked unit 1bda4cbc46\r\n\r\n---- Adding routes to 3 new units ----\r\n ---> Added route to unit 70dffc323b\r\n ---> Added route to unit 1bda4cbc46\r\n ---> Added route to unit cd00afcaed\r\n```\r\n```\r\nmilton_duarte@ts:~/tsuru-dashboard$ docker ps\r\nCONTAINER ID        IMAGE                                        COMMAND                CREATED              STATUS              PORTS                     NAMES\r\ncd00afcaed71        10.0.2.5:3030/tsuru/app-teste-andre:v5       \"/bin/bash -lc 'tsur   About a minute ago   Up About a minute   0.0.0.0:49197->8888/tcp   a5d1d178eb8151e51c99   \r\n70dffc323b6e        10.0.2.5:3030/tsuru/app-teste-andre:v5       \"/bin/bash -lc 'tsur   About a minute ago   Up About a minute   0.0.0.0:49195->8888/tcp   488f100a37fe964fab4b   \r\n1bda4cbc467c        10.0.2.5:3030/tsuru/app-teste-andre:v5       \"/bin/bash -lc 'tsur   About a minute ago   Up About a minute   0.0.0.0:49196->8888/tcp   6b99527f13e905228d0a   \r\n1fc403394f6b        10.0.2.5:3030/tsuru/app-blog:v3              \"/bin/bash -lc 'tsur   2 hours ago          Up 2 hours          0.0.0.0:49194->8888/tcp   2107930c469a236f7878   \r\nf7ee55a888f7        10.0.2.5:3030/tsuru/app-tsuru-dashboard:v9   \"/bin/bash -lc 'tsur   2 hours ago          Up 2 hours          0.0.0.0:49193->8888/tcp   1a7744e20f8f78f173f1   \r\n3cb8dc472e79        10.0.2.5:3030/tsuru/app-teste-andre:v5       \"/bin/bash -lc 'tsur   2 hours ago          Up 2 hours          0.0.0.0:49192->8888/tcp   83b88e94aaa5978c90fc   \r\n946d0f24cad7        10.0.2.5:3030/tsuru/app-teste-andre:v5       \"/bin/bash -lc 'tsur   2 hours ago          Up 2 hours          0.0.0.0:49191->8888/tcp   798ccc8f5d1735b4e930  \r\n```\r\n```\r\n\r\nmilton_duarte@ts:~/tsuru-dashboard$ tsuru app-info -a teste-andre\r\nApplication: teste-andre\r\nRepository: git@10.170.92.43.nip.io:teste-andre.git\r\nPlatform: php\r\nTeams: devops-rbs\r\nAddress: teste-andre.paas.rbs.com.br\r\nOwner: andre.trevisani@gruporbs.com.br\r\nTeam owner: devops-rbs\r\nDeploys: 7\r\nUnits: 5\r\n+------------+---------+-----------+-------+-------------+\r\n| Unit       | State   | Host      | Port  | IP          |\r\n+------------+---------+-----------+-------+-------------+\r\n| 946d0f24ca | started | 127.0.0.1 | 49191 | 172.17.0.60 |\r\n| 3cb8dc472e | started | 127.0.0.1 | 49192 | 172.17.0.61 |\r\n| 70dffc323b | started | 127.0.0.1 | 49195 | 172.17.0.68 |\r\n| 1bda4cbc46 | started | 127.0.0.1 | 49196 | 172.17.0.69 |\r\n| cd00afcaed | started | 127.0.0.1 | 49197 | 172.17.0.70 |\r\n+------------+---------+-----------+-------+-------------+\r\n\r\nApp Plan:\r\n+---------------+--------+------+-----------+--------+---------+\r\n| Name          | Memory | Swap | Cpu Share | Router | Default |\r\n+---------------+--------+------+-----------+--------+---------+\r\n| autogenerated | 0 MB   | 0 MB | 100       |        | false   |\r\n+---------------+--------+------+-----------+--------+---------+\r\n\r\n```\r\n```\r\nmilton_duarte@ts:~/tsuru-dashboard$ tsuru app-info -a teste-andre\r\nApplication: teste-andre\r\nRepository: git@10.170.92.43.nip.io:teste-andre.git\r\nPlatform: php\r\nTeams: devops-rbs\r\nAddress: teste-andre.paas.rbs.com.br\r\nOwner: andre.trevisani@gruporbs.com.br\r\nTeam owner: devops-rbs\r\nDeploys: 7\r\nUnits: 5\r\n+------------+---------+-----------+-------+-------------+\r\n| Unit       | State   | Host      | Port  | IP          |\r\n+------------+---------+-----------+-------+-------------+\r\n| 946d0f24ca | started | 127.0.0.1 | 49191 | 172.17.0.60 |\r\n| 3cb8dc472e | started | 127.0.0.1 | 49192 | 172.17.0.61 |\r\n| 70dffc323b | started | 127.0.0.1 | 49195 | 172.17.0.68 |\r\n| 1bda4cbc46 | started | 127.0.0.1 | 49196 | 172.17.0.69 |\r\n| cd00afcaed | started | 127.0.0.1 | 49197 | 172.17.0.70 |\r\n+------------+---------+-----------+-------+-------------+\r\n\r\nApp Plan:\r\n+---------------+--------+------+-----------+--------+---------+\r\n| Name          | Memory | Swap | Cpu Share | Router | Default |\r\n+---------------+--------+------+-----------+--------+---------+\r\n| autogenerated | 0 MB   | 0 MB | 100       |        | false   |\r\n+---------------+--------+------+-----------+--------+---------+\r\n```\r\n```\r\nmilton_duarte@ts:~/tsuru-dashboard$ tsuru unit-remove 4 -a teste-andre\r\nUnits successfully removed!\r\n```\r\n************ Here you can see that tsuru removed docker containers from Apps \"blog\" and \"tsuru-dashboard\" and stil remains three docker instances that belongs to App teste-andre*************\r\n```\r\nmilton_duarte@ts:~/tsuru-dashboard$ docker ps\r\nCONTAINER ID        IMAGE                                    COMMAND                CREATED             STATUS              PORTS                     NAMES\r\ncd00afcaed71        10.0.2.5:3030/tsuru/app-teste-andre:v5   \"/bin/bash -lc 'tsur   3 minutes ago       Up 3 minutes        0.0.0.0:49197->8888/tcp   a5d1d178eb8151e51c99   \r\n70dffc323b6e        10.0.2.5:3030/tsuru/app-teste-andre:v5   \"/bin/bash -lc 'tsur   3 minutes ago       Up 3 minutes        0.0.0.0:49195->8888/tcp   488f100a37fe964fab4b   \r\n1bda4cbc467c        10.0.2.5:3030/tsuru/app-teste-andre:v5   \"/bin/bash -lc 'tsur   3 minutes ago       Up 3 minutes        0.0.0.0:49196->8888/tcp   6b99527f13e905228d0a   \r\n```\r\n```\r\n\r\nmilton_duarte@ts:~/tsuru-dashboard$ tsuru app-list\r\n+-----------------+-------------------------+---------------------------------+\r\n| Application     | Units State Summary     | Address                         |\r\n+-----------------+-------------------------+---------------------------------+\r\n| blog            | 0 of 0 units in-service | blog.paas.rbs.com.br            |\r\n+-----------------+-------------------------+---------------------------------+\r\n| teste-andre     | 3 of 3 units in-service | teste-andre.paas.rbs.com.br     |\r\n+-----------------+-------------------------+---------------------------------+\r\n| tsuru-dashboard | 0 of 0 units in-service | tsuru-dashboard.paas.rbs.com.br |\r\n+-----------------+-------------------------+---------------------------------+\r\n\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/tsuru/tsuru/issues/comments/87037696","html_url":"https://github.com/tsuru/tsuru/issues/1153#issuecomment-87037696","issue_url":"https://api.github.com/repos/tsuru/tsuru/issues/1153","id":87037696,"user":{"login":"cezarsa","id":11041,"avatar_url":"https://avatars.githubusercontent.com/u/11041?v=3","gravatar_id":"","url":"https://api.github.com/users/cezarsa","html_url":"https://github.com/cezarsa","followers_url":"https://api.github.com/users/cezarsa/followers","following_url":"https://api.github.com/users/cezarsa/following{/other_user}","gists_url":"https://api.github.com/users/cezarsa/gists{/gist_id}","starred_url":"https://api.github.com/users/cezarsa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cezarsa/subscriptions","organizations_url":"https://api.github.com/users/cezarsa/orgs","repos_url":"https://api.github.com/users/cezarsa/repos","events_url":"https://api.github.com/users/cezarsa/events{/privacy}","received_events_url":"https://api.github.com/users/cezarsa/received_events","type":"User","site_admin":false},"created_at":"2015-03-27T18:13:23Z","updated_at":"2015-03-27T18:13:23Z","body":"Thanks for reporting @mwduarte! We're taking a look at it right now."}}