c.DockerSpawner.extra_host_config passes only network_mode to docker
See original GitHub issueHi all, I’m using DockerSpawner in a Docker Swarm setup. I was able to set the docker overlay network but I can not set the memory limit for the notebook containers.
# Additional args to create_host_config for container create
c.DockerSpawner.extra_host_config = {
'mem_limit': '300m',
'memswap_limit': '0b',
'network_mode': 'nw-docker',
'oom_kill_disable': False
}
This is the sample from my jupyterhub_config.py
file. Only the network_mode
setting is recognized by docker. I checked this by running docker inspect
on a running notebook container.
How can we fix this?
Thanks
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Docker spawn with host network mode · Issue #187 - GitHub
I got something working by assigning random ports in DockerSpawner and modifying the singleuser.sh script to pass a the port assignment along. I ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Super @matteoipri! Thanks for the detailed response 🍰
I’m going to label this a ‘reference’ since it will likely help someone else too.
To me it is not clear, if the line in
/etc/default/grub
has to be added forDockerSpawner
to pick up the config parameters about memory and swap memory. Can someone please clarify which of the steps @matteoipri described are necessary in which setup (DockerSpawner and normal Spawner used by JupyterHub)?At the moment I see the opposite, with a configuration of:
DockerSpawner
does not set a swap limit. It does not appear indocker inspect container-name
. Instead I see-1
there for memory swap limit.Also: Does the cgroup
memory
usually already exist on a Ubuntu machine? Or was it created and configured elsewhere, before running the containers the way described?