question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

c.DockerSpawner.extra_host_config passes only network_mode to docker

See original GitHub issue

Hi 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:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
willingccommented, Oct 12, 2016

Super @matteoipri! Thanks for the detailed response 🍰

I’m going to label this a ‘reference’ since it will likely help someone else too.

1reaction
ZelphirKaltstahlcommented, Mar 10, 2017

To me it is not clear, if the line in /etc/default/grub has to be added for DockerSpawner 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:

c.DockerSpawner.extra_host_config = {
    'network_mode': network_name,
    'cpuset_cpus': '0-3',
    'mem_limit': '1024m',
    'memswap_limit': '2048m'
}

DockerSpawner does not set a swap limit. It does not appear in docker 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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found