background
Docker startup errors can be seen205/limit
This error message tells you that the file descriptor settings of the Linux operating system do not match Docker, or the settings are relatively small.
Solution
Everything in linux is a file. For example, a socket will be represented by a file descriptor, so the size of the file descriptor in the Linux system is crucial to the system. For example, when there is high concurrency, if the file descriptor is too small, the concurrency of the server will not be increased.
To solve205/limit
There are two ways to use.
- Modify system file descriptors
vim /etc/
:
# sysctl settings are defined through files in # /usr/lib//, /run//, and /etc//. # # Vendors settings live in /usr/lib//. # To override a whole file, create a new file with the same in # /etc// and put new settings there. To override # only specific settings, add a file with a lexically later # name in /etc// and put new settings there. # # For more information, see (5) and (5). -max =6553600 # Fill in according to the actual situation.fs.nr_open = 6553600
Modify the file and execute the commandsysctl -p
Command to make the settings take effect and restart dockersystemctl restart docker
- Modify Docker's file path
/usr/lib/systemd/system/
The configuration of file descriptors in a file can be modified smaller than the maximum file descriptors configured by the system.
[Unit] Description=Docker Application Container Engine Documentation= BindsTo= After= Wants= Requires= [Service] Type=notify # the default is not to use systemd for cgroups because the delegate issues still # exists and systemd currently does not support the cgroup feature set required # for containers run by docker ExecStart=/usr/bin/dockerd --exec-opt==cgroupfs --log-level=warn --log-opt max-size=50M --storage-driver=overlay2 -H fd:// --containerd=/run/containerd/ -H unix:///var/run/ -H tcp://0.0.0.0:900 --data-root=/data1/docker_customized ExecReload=/bin/kill -s HUP $MAINPID TimeoutSec=0 RestartSec=2 Restart=always # Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229. # Both the old, and new location are accepted by systemd 229 and up, so using the old location # to make them work for either version of systemd. StartLimitBurst=3 # Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230. # Both the old, and new name are accepted by systemd 230 and up, so using the old name to make # this option work for either version of systemd. StartLimitInterval=60s # Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. LimitNOFILE=6553500 # Modify hereLimitNPROC=infinity LimitCORE=infinity # Comment TasksMax if your systemd version does not supports it. # Only systemd 226 and above support this option. TasksMax=infinity # set delegate yes so that systemd does not reset the cgroups of docker containers Delegate=yes # kill only the docker process, not all processes in the cgroup KillMode=process [Install] WantedBy=
After modifying Docker, you may also need to modify containerd's startup configuration file and file path/usr/lib/systemd/system/
[Unit] Description=containerd container runtime Documentation= After= [Service] ExecStartPre=-/sbin/modprobe overlay ExecStart=/usr/bin/containerd KillMode=process Delegate=yes LimitNOFILE=6553500 # Modify here# Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. LimitNPROC=infinity LimitCORE=infinity TasksMax=infinity [Install] WantedBy=
Modify the file and execute it firstsystemctl daemon-reload
Then executesystemctl restart docker
docker starts normally.
The above is the detailed content of the solution for docker startup error 205/limit. For more information about docker startup error 205/limit, please pay attention to my other related articles!