{"action":"created","issue":{"url":"https://api.github.com/repos/portainer/portainer/issues/2016","repository_url":"https://api.github.com/repos/portainer/portainer","labels_url":"https://api.github.com/repos/portainer/portainer/issues/2016/labels{/name}","comments_url":"https://api.github.com/repos/portainer/portainer/issues/2016/comments","events_url":"https://api.github.com/repos/portainer/portainer/issues/2016/events","html_url":"https://github.com/portainer/portainer/issues/2016","id":337837680,"node_id":"MDU6SXNzdWUzMzc4Mzc2ODA=","number":2016,"title":"Docker API in Swarm mode: \"No such container\"","user":{"login":"lukey78","id":2877837,"node_id":"MDQ6VXNlcjI4Nzc4Mzc=","avatar_url":"https://avatars3.githubusercontent.com/u/2877837?v=4","gravatar_id":"","url":"https://api.github.com/users/lukey78","html_url":"https://github.com/lukey78","followers_url":"https://api.github.com/users/lukey78/followers","following_url":"https://api.github.com/users/lukey78/following{/other_user}","gists_url":"https://api.github.com/users/lukey78/gists{/gist_id}","starred_url":"https://api.github.com/users/lukey78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukey78/subscriptions","organizations_url":"https://api.github.com/users/lukey78/orgs","repos_url":"https://api.github.com/users/lukey78/repos","events_url":"https://api.github.com/users/lukey78/events{/privacy}","received_events_url":"https://api.github.com/users/lukey78/received_events","type":"User","site_admin":false},"labels":[{"id":651297673,"node_id":"MDU6TGFiZWw2NTEyOTc2NzM=","url":"https://api.github.com/repos/portainer/portainer/labels/area/api","name":"area/api","color":"fbca04","default":false},{"id":379305042,"node_id":"MDU6TGFiZWwzNzkzMDUwNDI=","url":"https://api.github.com/repos/portainer/portainer/labels/kind/question","name":"kind/question","color":"bfdadc","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-03T10:25:41Z","updated_at":"2018-07-04T06:43:28Z","closed_at":"2018-07-03T18:54:33Z","author_association":"NONE","body":"**Bug description**\r\n\r\nUsing Portainer Docker API Proxy in a Swarm Mode environment (Portainer Agent installed on all nodes) does not work each time. \r\n\r\nOften we just get \"No such container\" or \"502 Bad Gateway\" or \"Page not found\" errors.\r\n\r\n\r\n**Expected behavior**\r\n\r\nWhen issuing an API request to the Docker API on one container like /api/endpoints/1/docker/containers/7d136af23eb5/top should work as it does in the UI. \r\n\r\n\r\n**Steps to reproduce the issue:**\r\n\r\nSteps to reproduce the behavior:\r\n1. Create a Swarm mode setup with 3 nodes\r\n2. Deploy some containers around the cluster\r\n3. Use the Portainer API in Docker API proxy mode to execute API calls against a specific container\r\n4. In some cases this will work, in most cases it will fail\r\n\r\n**Technical details:**\r\n\r\n* Portainer version: 1.18.1\r\n* Docker version (managed by Portainer): 18.03.1-ce\r\n* Platform (windows/linux): Linux\r\n\r\n**Additional context**\r\n\r\nIt seems the API requests are not properly redirected to the appropriate Portainer-Agent.\r\n"},"comment":{"url":"https://api.github.com/repos/portainer/portainer/issues/comments/402379681","html_url":"https://github.com/portainer/portainer/issues/2016#issuecomment-402379681","issue_url":"https://api.github.com/repos/portainer/portainer/issues/2016","id":402379681,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjM3OTY4MQ==","user":{"login":"lukey78","id":2877837,"node_id":"MDQ6VXNlcjI4Nzc4Mzc=","avatar_url":"https://avatars3.githubusercontent.com/u/2877837?v=4","gravatar_id":"","url":"https://api.github.com/users/lukey78","html_url":"https://github.com/lukey78","followers_url":"https://api.github.com/users/lukey78/followers","following_url":"https://api.github.com/users/lukey78/following{/other_user}","gists_url":"https://api.github.com/users/lukey78/gists{/gist_id}","starred_url":"https://api.github.com/users/lukey78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukey78/subscriptions","organizations_url":"https://api.github.com/users/lukey78/orgs","repos_url":"https://api.github.com/users/lukey78/repos","events_url":"https://api.github.com/users/lukey78/events{/privacy}","received_events_url":"https://api.github.com/users/lukey78/received_events","type":"User","site_admin":false},"created_at":"2018-07-04T06:43:28Z","updated_at":"2018-07-04T06:43:28Z","author_association":"NONE","body":"Hi @deviantony, ok that works, thanks. Is that somewhere mentioned in the API docs?\r\n\r\nSo the correct way would be query-filtering the container list (that should work on each node for the whole swarm?), fetching out the \"NodeName\" and then specifically target that node with the X-Portainer-Agent-Target header?\r\n"}}
{"actor":{"display_login":"lukey78"}}