{"action":"created","issue":{"url":"https://api.github.com/repos/netguru/capistrano-docker/issues/2","repository_url":"https://api.github.com/repos/netguru/capistrano-docker","labels_url":"https://api.github.com/repos/netguru/capistrano-docker/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/netguru/capistrano-docker/issues/2/comments","events_url":"https://api.github.com/repos/netguru/capistrano-docker/issues/2/events","html_url":"https://github.com/netguru/capistrano-docker/pull/2","id":147005246,"number":2,"title":"Add option to clean before run","user":{"login":"JamesCarscadden","id":236038,"avatar_url":"https://avatars.githubusercontent.com/u/236038?v=3","gravatar_id":"","url":"https://api.github.com/users/JamesCarscadden","html_url":"https://github.com/JamesCarscadden","followers_url":"https://api.github.com/users/JamesCarscadden/followers","following_url":"https://api.github.com/users/JamesCarscadden/following{/other_user}","gists_url":"https://api.github.com/users/JamesCarscadden/gists{/gist_id}","starred_url":"https://api.github.com/users/JamesCarscadden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JamesCarscadden/subscriptions","organizations_url":"https://api.github.com/users/JamesCarscadden/orgs","repos_url":"https://api.github.com/users/JamesCarscadden/repos","events_url":"https://api.github.com/users/JamesCarscadden/events{/privacy}","received_events_url":"https://api.github.com/users/JamesCarscadden/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/netguru/capistrano-docker/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-08T18:40:14Z","updated_at":"2016-04-11T13:18:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/netguru/capistrano-docker/pulls/2","html_url":"https://github.com/netguru/capistrano-docker/pull/2","diff_url":"https://github.com/netguru/capistrano-docker/pull/2.diff","patch_url":"https://github.com/netguru/capistrano-docker/pull/2.patch"},"body":"- Containers started with an option such as -p 80:9292 need to be\r\n  stopped before subsequent containers are started with the same\r\n  option, otherwise there will be a conflict. Added an option\r\n  \"docker_clean_before_run\" which defaults to false in order to\r\n  preserve original behaviour. When set to true, tasks will be\r\n  executed as \"prepare build clean run tag\" instead of\r\n  \"prepare build run clean tag\".\r\n\r\nIt might be more correct to simply stop the previous container as part of the 'run' task and then allowing the normal clean to go ahead, rather than cleaning by changing the order of tasks as I have done here. However that would also involve changing the existing 'old_containers' method to use 'ps -a' in order to find the already stopped containers. That may in fact be a desirable change though as it would clean and remove old containers that have stopped for other reasons than a deployment."},"comment":{"url":"https://api.github.com/repos/netguru/capistrano-docker/issues/comments/208337802","html_url":"https://github.com/netguru/capistrano-docker/pull/2#issuecomment-208337802","issue_url":"https://api.github.com/repos/netguru/capistrano-docker/issues/2","id":208337802,"user":{"login":"JamesCarscadden","id":236038,"avatar_url":"https://avatars.githubusercontent.com/u/236038?v=3","gravatar_id":"","url":"https://api.github.com/users/JamesCarscadden","html_url":"https://github.com/JamesCarscadden","followers_url":"https://api.github.com/users/JamesCarscadden/followers","following_url":"https://api.github.com/users/JamesCarscadden/following{/other_user}","gists_url":"https://api.github.com/users/JamesCarscadden/gists{/gist_id}","starred_url":"https://api.github.com/users/JamesCarscadden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JamesCarscadden/subscriptions","organizations_url":"https://api.github.com/users/JamesCarscadden/orgs","repos_url":"https://api.github.com/users/JamesCarscadden/repos","events_url":"https://api.github.com/users/JamesCarscadden/events{/privacy}","received_events_url":"https://api.github.com/users/JamesCarscadden/received_events","type":"User","site_admin":false},"created_at":"2016-04-11T13:18:47Z","updated_at":"2016-04-11T13:18:47Z","body":"Yeah, I considered using something like the proxy, but in my particular case at the moment, I'm running on the Microsoft Azure cloud and it make more sense in that case to use their load balancer resource that sits in front of the app servers, since then new servers can be dynamically added, rather than using NGINX or similar to do the same "}}