<pre><code>kubectl create secret docker-registry $SECRET_NAME \
                 --dry-run=client \
                 --docker-server=&quot;$ECR_REGISTRY&quot; \
                 --docker-username=AWS \
                 --docker-password=&quot;$(&lt;/token/ecr-token)&quot; \
                 -o yaml
</code></pre>
<p>file token/ecr-token is in place but still not able to populate in --docker-password</p>

kapil dev
<p>The <code>$(&lt; /path/to/a/file)</code> syntax is a special form of command substitution that is supported by several UNIX shells, including <a href="https://docs.oracle.com/cd/E36784_01/html/E36870/ksh-1.html" rel="nofollow noreferrer">ksh</a> (Oracle online documentation), <a href="https://www.gnu.org/savannah-checkouts/gnu/bash/manual/html_node/Command-Substitution.html#Command-Substitution" rel="nofollow noreferrer">bash</a>, and <a href="https://zsh.sourceforge.io/Doc/Release/Expansion.html#Command-Substitution" rel="nofollow noreferrer">zsh</a>. It attempts to open the listed file and then reads the contents of that file in place of the <code>$(&lt; ...)</code>. It is distinct from command substitution in that it does not execute the given file or its contents.</p>
<p>See more details at this UNIX &amp; Linux Q/A: <a href="https://unix.stackexchange.com/q/189749/117549">Understanding Bash's Read-a-File Command Substitution</a>.</p>
<p>Note that your command specifies an <em>absolute</em> file path of <code>/token/ecr-token</code> but then later describe a <em>relative</em> path of <code>token/ecr-token</code>. If you're using a relative path in the command-line, that file will need to exist relative to your current working directory. Of course, the file must be readable by the current user for the contents to be read.</p>
<p>If your shell does not support this feature, a workaround is to use <code>$(cat /path/to/a/file)</code>, for instance:</p>
<pre class="lang-sh prettyprint-override"><code>kubectl create secret docker-registry &quot;$SECRET_NAME&quot; \
                 --dry-run=client \
                 --docker-server=&quot;$ECR_REGISTRY&quot; \
                 --docker-username=AWS \
                 --docker-password=&quot;$(cat /token/ecr-token)&quot; \
                 -o yaml
</code></pre>
