Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting key "vm.overcommit_memory": Read-only file system #1

Closed
CybotTM opened this issue Sep 16, 2015 · 6 comments
Closed

setting key "vm.overcommit_memory": Read-only file system #1

CybotTM opened this issue Sep 16, 2015 · 6 comments
Assignees

Comments

@CybotTM
Copy link

CybotTM commented Sep 16, 2015

sysctl vm.overcommit_memory=1
sysctl: setting key "vm.overcommit_memory": Read-only file system

see redis/docker-library-redis#19

@openfirmware
Copy link
Owner

Thanks for the heads up, I am taking a look at the cause.

@openfirmware
Copy link
Owner

It appears that /proc is read-only (docker#5703), and sysctl cannot edit the vm overcommit memory setting unless docker runs the container with the --privileged setting (source). This does change the value on the docker host as well.

This leaves three options.

  1. Enable sysctl vm.overcommit_memory=1 on the docker host and it will apply to all running containers, including docker-redis.
  2. Run docker-redis with --privileged, thus enabling vm.overcommit_memory for the docker host and all other containers. I do not recommend this as it is not obvious that the container made a change to your docker host.
  3. Run docker-redis as-is and let Redis run without vm.overcommit_memory.

I will update the README to note this limitation.

@openfirmware openfirmware self-assigned this Sep 16, 2015
@CVirus
Copy link

CVirus commented Sep 5, 2016

Enabling sysctl vm.overcommit_memory=1 on the docker host will NOT be inherited by the running containers :-(

EDIT1: Yes it will inherit.
EDIT2: It won't inherit on some OS configurations/machines.. still investigating.
EDIT3: Final findings .. overcommit_memory is inherited in all cases (my bad) .. somaxconn is inherited only when the container runs in host networking mode.

@Mehonoshin
Copy link

Hey, folks. Has anyone solved this issue?

@0xO0O0
Copy link

0xO0O0 commented Jun 26, 2017

anyone at all?

@openfirmware
Copy link
Owner

I checked with Docker 17.03.1-ce today and option #1 I mentioned above seems to work on Ubuntu 14.04.5 LTS host:

host# sysctl vm.overcommit_memory
vm.overcommit_memory = 0
host# docker run -it --rm openfirmware/redis sysctl vm.overcommit_memory
vm.overcommit_memory = 0
host# sysctl vm.overcommit_memory=1
vm.overcommit_memory = 1
host# sysctl vm.overcommit_memory
vm.overcommit_memory = 0
host# docker run -it --rm openfirmware/redis sysctl vm.overcommit_memory
vm.overcommit_memory = 1

Option #2 doesn't work for me though. Let me know if that doesn't work for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants