In this article, I just want to discuss two of the major memory issues we have faced while working with dockers.
1. Default docker uses the base directory as /var/lib/docker and due to memory constraints many times we need to change this default to some other path. There are two ways to do this- One is to go with the "symlink" to refer some other directory and another way is to use docker provided "-g" option. The problem with the first approach is that after every docker service restart, the symlink directory is getting unmounted and to mount again we have to restart the host machine.
To resolve this, using second approach, we have to use '-g' option that docker provides. In Centos the guide says we should edit /etc/sysconfig/docker, and add the -g option in the other_args variable: ex. other_args="-g /var/lib/testdir" but this was not getting picked somehow in our AWS server. So after some research we have included this option in the UCD start docker component itself.
2. Second issue related to memory is that by default for any docker container the root is assigned 10gb of space and for WAS installation more than 10GB space is required. For this we need to append another attribute --storage-opt dm.basesize=25G. This will fix the problem.
To fix above, our final docker start command looks like
nohup sudo /usr/bin/docker daemon -g /opt/NewDirectory --storage-driver=devicemapper --storage-opt dm.basesize=25GB --storage-opt dm.loopmetadatasize=4GB --insecure-registry HN_OR_IP_ADDR_HERE:5000 --log-level="debug" >dockerlog.txt
Some good links on the above:
1. Default docker uses the base directory as /var/lib/docker and due to memory constraints many times we need to change this default to some other path. There are two ways to do this- One is to go with the "symlink" to refer some other directory and another way is to use docker provided "-g" option. The problem with the first approach is that after every docker service restart, the symlink directory is getting unmounted and to mount again we have to restart the host machine.
To resolve this, using second approach, we have to use '-g' option that docker provides. In Centos the guide says we should edit /etc/sysconfig/docker, and add the -g option in the other_args variable: ex. other_args="-g /var/lib/testdir" but this was not getting picked somehow in our AWS server. So after some research we have included this option in the UCD start docker component itself.
2. Second issue related to memory is that by default for any docker container the root is assigned 10gb of space and for WAS installation more than 10GB space is required. For this we need to append another attribute --storage-opt dm.basesize=25G. This will fix the problem.
To fix above, our final docker start command looks like
nohup sudo /usr/bin/docker daemon -g /opt/NewDirectory --storage-driver=devicemapper --storage-opt dm.basesize=25GB --storage-opt dm.loopmetadatasize=4GB --insecure-registry HN_OR_IP_ADDR_HERE:5000 --log-level="debug" >dockerlog.txt
Some good links on the above:

No comments:
Post a Comment