{"action":"created","issue":{"url":"https://api.github.com/repos/spotify/docker-client/issues/363","repository_url":"https://api.github.com/repos/spotify/docker-client","labels_url":"https://api.github.com/repos/spotify/docker-client/issues/363/labels{/name}","comments_url":"https://api.github.com/repos/spotify/docker-client/issues/363/comments","events_url":"https://api.github.com/repos/spotify/docker-client/issues/363/events","html_url":"https://github.com/spotify/docker-client/pull/363","id":138875532,"number":363,"title":"Support for container rename","user":{"login":"johnflavin","id":1417503,"avatar_url":"https://avatars.githubusercontent.com/u/1417503?v=3","gravatar_id":"","url":"https://api.github.com/users/johnflavin","html_url":"https://github.com/johnflavin","followers_url":"https://api.github.com/users/johnflavin/followers","following_url":"https://api.github.com/users/johnflavin/following{/other_user}","gists_url":"https://api.github.com/users/johnflavin/gists{/gist_id}","starred_url":"https://api.github.com/users/johnflavin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnflavin/subscriptions","organizations_url":"https://api.github.com/users/johnflavin/orgs","repos_url":"https://api.github.com/users/johnflavin/repos","events_url":"https://api.github.com/users/johnflavin/events{/privacy}","received_events_url":"https://api.github.com/users/johnflavin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-03-07T03:24:42Z","updated_at":"2016-03-21T16:02:13Z","closed_at":"2016-03-08T23:56:18Z","pull_request":{"url":"https://api.github.com/repos/spotify/docker-client/pulls/363","html_url":"https://github.com/spotify/docker-client/pull/363","diff_url":"https://github.com/spotify/docker-client/pull/363.diff","patch_url":"https://github.com/spotify/docker-client/pull/363.patch"},"body":"Addresses issue #361.\r\n\r\nThis is a first pass. I have two main caveats that I would like some feedback on before considering this final.\r\n\r\n* The [API](https://docs.docker.com/engine/reference/api/docker_remote_api_v1.18/) says the `rename` request can throw a `409` if the name is already assigned. Should I convert that into a named exception, à la `404 → ContainerNotFoundException`?\r\n* I ran into a docker bug (or, perhaps, non-documented feature) where the `name` field returned by `container inspect <id>` has a leading `/`. See [#18558](https://github.com/docker/docker/issues/18558).  I created a test for my changes, but as I am testing the value of the name I had to change the comparison I'm making based on the API version. I'm running client 1.9.1 (API 1.21), so I am not able to test that the tests pass on lower APIs. (Though I guess CircleCI will make see if it passes on 1.20.) Any help testing on other versions would be appreciated."},"comment":{"url":"https://api.github.com/repos/spotify/docker-client/issues/comments/199356150","html_url":"https://github.com/spotify/docker-client/pull/363#issuecomment-199356150","issue_url":"https://api.github.com/repos/spotify/docker-client/issues/363","id":199356150,"user":{"login":"mattnworb","id":113840,"avatar_url":"https://avatars.githubusercontent.com/u/113840?v=3","gravatar_id":"","url":"https://api.github.com/users/mattnworb","html_url":"https://github.com/mattnworb","followers_url":"https://api.github.com/users/mattnworb/followers","following_url":"https://api.github.com/users/mattnworb/following{/other_user}","gists_url":"https://api.github.com/users/mattnworb/gists{/gist_id}","starred_url":"https://api.github.com/users/mattnworb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattnworb/subscriptions","organizations_url":"https://api.github.com/users/mattnworb/orgs","repos_url":"https://api.github.com/users/mattnworb/repos","events_url":"https://api.github.com/users/mattnworb/events{/privacy}","received_events_url":"https://api.github.com/users/mattnworb/received_events","type":"User","site_admin":false},"created_at":"2016-03-21T16:02:13Z","updated_at":"2016-03-21T16:02:13Z","body":"FWIW I get the same behavior with `docker inspect` showing a leading slash in the name even as far back as docker version 1.6.2. I think it happens any time you create a container with a specified name.\r\n\r\nFor instance:\r\n\r\n```bash\r\n$ docker version\r\nClient version: 1.6.2\r\nClient API version: 1.18\r\nGo version (client): go1.4.2\r\nGit commit (client): 7c8fca2\r\nOS/Arch (client): linux/amd64\r\nServer version: 1.6.2\r\nServer API version: 1.18\r\nGo version (server): go1.4.2\r\nGit commit (server): 7c8fca2\r\nOS/Arch (server): linux/amd64\r\n\r\n$ docker create --name=foo busybox:latest\r\nb7610256b0e083e2c2f4f3e6c5a302857ab018d49b317a150917d1ae8e9122c2\r\n\r\n$ docker inspect -f '{{.Name}}' foo\r\n/foo\r\n```"}}