Amazon Linux2でdockerを動かす際、open files制限に引っかかってしまった。systemdのdocker.serviveやlimits.confでの設定はしていたが、dockerコンテナを起動してもlimitsが1024:4096となってしまう。
どうも、docker.serviceの環境定義ファイルのオプションで指定されているようだった。
/etc/sysconfig/docker
| 
 1 2 3 4 5 6 7 8 9 10 11 12 13  | 
# The max number of open files for the daemon itself, and all # running containers.  The default value of 1048576 mirrors the value # used by the systemd service unit. DAEMON_MAXFILES=1048576 # Additional startup options for the Docker daemon, for example: # OPTIONS="--ip-forward=true --iptables=true" # By default we limit the number of open files per container OPTIONS="--default-ulimit nofile=1024:4096" # How many seconds the sysvinit script waits for the pidfile to appear # when starting the daemon. DAEMON_PIDFILE_TIMEOUT=10  | 
--default-ulimit ulimitの値を変更してあげればよい。それ以外では、オプションでなく/etc/docker/daemon.jsonを利用してもよいかもしれない。
| 
 1 2 3 4 5 6 7  | 
"default-ulimits": {     "nofile": {         "Name": "nofile",         "Hard": 64000,         "Soft": 64000     } },  | 
amazon-linux-extrasのdocker
パッケージの中身を確認する。
| 
 1 2 3 4 5 6 7 8 9 10  | 
$ rpm -ql docker /etc/docker /etc/docker-runtimes.d /etc/sysconfig/docker /etc/sysconfig/docker-storage ...省略 /var/lib/docker $ yumdownloader docker $ rpm2cpio docker-19.03.13ce-1.amzn2.x86_64.rpm | cpio -id $ ls docker-19.03.13ce-1.amzn2.x86_64.rpm etc usr var work   | 
参考リンク
- https://docs.docker.com/engine/reference/commandline/dockerd/
 - https://github.com/awslabs/amazon-eks-ami/issues/278
 
  


コメント