In Docker references, I didn’t find any information about how long the string can be passed to Docker CMD.
- What are the limitations?
- What is the maximum number of characters I can pass to CMD?
In Docker references, I didn’t find any information about how long the string can be passed to Docker CMD.
2
Answers
I have done a simple test and found the limit of dockerfile line is 65535 on my CentOS 7/x64 machine.
@ZenithS You’re right for Windows (8192 Characters), but Linux is not that easy.
To make it short: For Linux it’s hardcoded to 64 or 128 kiB. You could check with
xargs --show-limits
, which gives a pretty detailed overview:The hardcoded limit goes to
MAX_ARG_STRLEN
which is set toPAGE_SIZE * 32
https://github.com/torvalds/linux/blob/v5.16-rc7/include/uapi/linux/binfmts.h#L15
With
getconf PAGE_SIZE
you can check (mostly 2048 or 4096 on modern platforms) so results to 64 or 128 kiB.