{"action":"opened","issue":{"url":"https://api.github.com/repos/docker/swarm/issues/475","labels_url":"https://api.github.com/repos/docker/swarm/issues/475/labels{/name}","comments_url":"https://api.github.com/repos/docker/swarm/issues/475/comments","events_url":"https://api.github.com/repos/docker/swarm/issues/475/events","html_url":"https://github.com/docker/swarm/issues/475","id":61720342,"number":475,"title":"CPU shares is the number of CPUs rather than shares","user":{"login":"jhamrick","id":83444,"avatar_url":"https://avatars.githubusercontent.com/u/83444?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamrick","html_url":"https://github.com/jhamrick","followers_url":"https://api.github.com/users/jhamrick/followers","following_url":"https://api.github.com/users/jhamrick/following{/other_user}","gists_url":"https://api.github.com/users/jhamrick/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamrick/subscriptions","organizations_url":"https://api.github.com/users/jhamrick/orgs","repos_url":"https://api.github.com/users/jhamrick/repos","events_url":"https://api.github.com/users/jhamrick/events{/privacy}","received_events_url":"https://api.github.com/users/jhamrick/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-15T00:37:12Z","updated_at":"2015-03-15T00:37:12Z","closed_at":null,"body":"Swarm appears to interpret \"cpu shares\" as \"number of cpus\". For example, if I have a machine with 2 CPUs and I schedule a container with 512 CPU shares (which according to [the Docker documentation](https://docs.docker.com/reference/run/#runtime-constraints-on-cpu-and-memory) should give it 50% of CPU time), I get an error saying that there are no resources available to schedule the container:\r\n\r\n```\r\n$ docker --tls -H 127.0.0.1:2376 run -c 512 hello-world\r\nFATA[0000] Error response from daemon: no resources available to schedule container\r\n```\r\n\r\nIf I change the number of CPU shares to 1 or 2, then it runs fine. Once it gets to 3 CPU shares, though, the error reappears, implying that swarm is interpreting \"cpu shares\" as \"number of cpus\". Checking `docker inspect`, I see that a container scheduled with 1 CPU share actually ends up with 50 CPU shares (for 50%, perhaps?).\r\n\r\nMy intuition is that swarm should interpret CPU shares the same way that docker interprets CPU shares. Is there a reason why it doesn't work like that?"}}