{"action":"created","issue":{"url":"https://api.github.com/repos/jupyterhub/jupyterhub/issues/1599","repository_url":"https://api.github.com/repos/jupyterhub/jupyterhub","labels_url":"https://api.github.com/repos/jupyterhub/jupyterhub/issues/1599/labels{/name}","comments_url":"https://api.github.com/repos/jupyterhub/jupyterhub/issues/1599/comments","events_url":"https://api.github.com/repos/jupyterhub/jupyterhub/issues/1599/events","html_url":"https://github.com/jupyterhub/jupyterhub/issues/1599","id":284868958,"number":1599,"title":"How to specify docker run parameters when using dockerSpawner?","user":{"login":"ppLorins","id":5534049,"avatar_url":"https://avatars1.githubusercontent.com/u/5534049?v=4","gravatar_id":"","url":"https://api.github.com/users/ppLorins","html_url":"https://github.com/ppLorins","followers_url":"https://api.github.com/users/ppLorins/followers","following_url":"https://api.github.com/users/ppLorins/following{/other_user}","gists_url":"https://api.github.com/users/ppLorins/gists{/gist_id}","starred_url":"https://api.github.com/users/ppLorins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ppLorins/subscriptions","organizations_url":"https://api.github.com/users/ppLorins/orgs","repos_url":"https://api.github.com/users/ppLorins/repos","events_url":"https://api.github.com/users/ppLorins/events{/privacy}","received_events_url":"https://api.github.com/users/ppLorins/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-28T08:45:23Z","updated_at":"2017-12-28T11:07:40Z","closed_at":"2017-12-28T11:07:40Z","author_association":"NONE","body":"I've build an image which satisfy the requirements of being used by dockerSpawner. But I wanna to add some extra docker run parameters which are not found in dockerSpawner's document like '--cpus=\"1.0\"' to limit cpu resource the container can use, '--user=my_user' to let the container running under a specific user that are created in image building progress.\r\n\r\nI think this can be done in dockerSpawner or jupyterhub , but haven't find the way .\r\nCan anyone help ?"},"comment":{"url":"https://api.github.com/repos/jupyterhub/jupyterhub/issues/comments/354271781","html_url":"https://github.com/jupyterhub/jupyterhub/issues/1599#issuecomment-354271781","issue_url":"https://api.github.com/repos/jupyterhub/jupyterhub/issues/1599","id":354271781,"user":{"login":"ppLorins","id":5534049,"avatar_url":"https://avatars1.githubusercontent.com/u/5534049?v=4","gravatar_id":"","url":"https://api.github.com/users/ppLorins","html_url":"https://github.com/ppLorins","followers_url":"https://api.github.com/users/ppLorins/followers","following_url":"https://api.github.com/users/ppLorins/following{/other_user}","gists_url":"https://api.github.com/users/ppLorins/gists{/gist_id}","starred_url":"https://api.github.com/users/ppLorins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ppLorins/subscriptions","organizations_url":"https://api.github.com/users/ppLorins/orgs","repos_url":"https://api.github.com/users/ppLorins/repos","events_url":"https://api.github.com/users/ppLorins/events{/privacy}","received_events_url":"https://api.github.com/users/ppLorins/received_events","type":"User","site_admin":false},"created_at":"2017-12-28T11:07:40Z","updated_at":"2017-12-28T11:07:40Z","author_association":"NONE","body":"I found by using **c.DockerSpawner.extra_create_kwargs**  can achieve my goal: \r\n```json\r\nc.DockerSpawner.extra_create_kwargs = {\r\n    'user': 'jupyter',\r\n}\r\n```\r\nIt finally pass the 'user' parameter to **create_container** function in docker api (docker/api/contianer.py), and the available parameters when creating containers are indicated in the function's signature : \r\n```json\r\n    def create_container(self, image, command=None, hostname=None, user=None,\r\n                         detach=False, stdin_open=False, tty=False,\r\n                         mem_limit=None, ports=None, environment=None,\r\n                         dns=None, volumes=None, volumes_from=None,\r\n                         network_disabled=False, name=None, entrypoint=None,\r\n                         cpu_shares=None, working_dir=None, domainname=None,\r\n                         memswap_limit=None, cpuset=None, host_config=None,\r\n                         mac_address=None, labels=None, volume_driver=None,\r\n                         stop_signal=None, networking_config=None,\r\n                         healthcheck=None, stop_timeout=None, runtime=None):\r\n```\r\n\r\nFYI\r\n\r\n"}}
{"actor":{"display_login":"ppLorins"}}