<p>I am using the mssql docker image (Linux) for sql server 2019. The default user is not <code>root</code> but <code>mssql</code>.
I need to perform some operations as <code>root</code> inside the container:</p>
<pre><code>docker exec -it sql bash
mssql@7f5a78a63728:/$ sudo &lt;command&gt;
bash: sudo: command not found
</code></pre>
<p>Then I start the shell as <code>root</code>:</p>
<pre><code>docker exec -it --user=root sql bash
root@7f5a78a63728:/# &lt;command&gt;
...
</code></pre>
<p>This works.</p>
<p>Now I need to do this in a container deployed in an AKS cluster</p>
<pre><code>kubectl  exec -it  rms-sql-1-sql-server-deployment-86cc45dc5c-tgtm2 -- bash
mssql@rms-sql-1-sql-server-host:/$ sudo &lt;command&gt;
bash: sudo: command not found
</code></pre>
<p>as expected. But then:</p>
<pre><code>kubectl  exec -it --user=root  rms-sql-1-sql-server-deployment-86cc45dc5c-tgtm2 -- bash
error: auth info &quot;root&quot; does not exist
</code></pre>
<p>So when the container is in an AKS cluster, starting a shell as <code>root</code> doesn't work.</p>
<p>I then try to ssh into the node and use docker from inside:</p>
<pre><code>kubectl debug node/aks-agentpool-30797540-vmss000000 -it --image=mcr.microsoft.com/aks/fundamental/base-ubuntu:v0.0.11

Creating debugging pod node-debugger-aks-agentpool-30797540-vmss000000-xfrsq with container debugger on node aks-agentpool-30797540-vmss000000.
If you don't see a command prompt, try pressing enter.

root@aks-agentpool-30797540-vmss000000:/# docker ...
bash: docker: command not found

</code></pre>
<p>Looks like a Kubernetes cluster node doesn't have docker installed!</p>
<p>Any clues?</p>
<p><strong>EDIT</strong></p>
<p>The image I used locally and in Kubernetes is exactly the same,</p>
<pre><code>mcr.microsoft.com/mssql/server:2019-latest untouched
</code></pre>

Franco Tiveron
<p><a href="https://stackoverflow.com/users/10008173/david-maze" title="74,731 reputation">David Maze</a> has well mentioned in the comment:</p>
<blockquote>
<p>Any change you make in this environment will be lost as soon as the Kubernetes pod is deleted, including if you need to update the underlying image or if its node goes away outside of your control. Would building a custom image with your changes be a more maintainable solution?</p>
</blockquote>
<p>Generally, if you want to change something permanently you have to create a new image. Everything you described behaved exactly as it was supposed to. First you have exec the container in docker, then logged in as root. However, in k8s it is a completely different container. Perhaps a different image is used. Second, even if you made a change, it would exist until the container dies. If you want to modify something permanently, you have to create your new image with all the components and the configuration you need. For more information look at <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/" rel="nofollow noreferrer">pod lifecycle</a>.</p>
