Refresh Net.Core.Somaxcomm (Or Any Sysctl Property) for Docker Containers

Refresh net.core.somaxcomm (or any sysctl property) for docker containers

Just figured out how to solve this, now Elastic Beanstalk supports running a privileged containers and you just need to add the "privileged": "true" to your Dockerrun.aws.json as the following sample (please take a look at the container-1):

{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [{
"name": "container-0",
"essential": "false",
"image": "ubuntu",
"memory": "512"
}, {
"name": "container-1",
"essential": "false",
"image": "ubuntu",
"memory": "512",
"privileged": "true"
}]
}

Please note that I duplicated this answer from another thread.

Running commands in a Docker file

Setting sysctl's is only possible at runtime with the --sysctl option. From the docker-run(1) manual:

   Configure namespaced kernel parameters at runtime

IPC Namespace - current sysctls allowed:

kernel.msgmax, kernel.msgmnb, kernel.msgmni, kernel.sem, kernel.shmall, kernel.shmmax, kernel.shmmni, kernel.shm_rmid_forced
Sysctls beginning with fs.mqueue.*

If you use the --ipc=host option these sysctls will not be allowed.

Network Namespace - current sysctls allowed:
Sysctls beginning with net.*

If you use the --network=host option these sysctls will not be allowed.

For example, for /proc/sys/net/core/somaxconn you may use --sysctl net.core.somaxconn=4096.

Other kernel parameters in procfs and sysfs may be inherited (though others are not), so you should set them on the host.

Editing Files from dockerfile

I would use the following approach in the Dockerfile

RUN   echo "Some line to add to a file" >> /etc/sysctl.conf

That should do the trick. If you wish to replace some characters or similar you can work this out with sed by using e.g. the following:

RUN   sed -i "s|some-original-string|the-new-string |g" /etc/sysctl.conf

However, if your problem lies in simply getting the settings to "bite" this question might be of help.

Is it possible to launch privileged docker containers on Amazon elasticbeanstalk?

Just figured out how to solve this, now Elastic Beanstalk supports running a privileged containers and you just need to add the "privileged": "true" to your Dockerrun.aws.json as the following sample (please take a look at the container-1):

{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [{
"name": "container-0",
"image": "ubuntu",
"memory": "512"
}, {
"name": "container-1",
"image": "ubuntu",
"memory": "512",
"privileged": "true"
}]
}


Related Topics



Leave a reply



Submit