<p>I'm trying to debug my application, which is running in kubernetes in a docker container. The image is built using sbt native-packager docker plugin. I would like to login to the pod and investigate there, but the default user account (<code>demiourgos728</code>) has no privileges and I don't know how to switch to a root account.</p>

<p>I've tried running <code>kubectl exec --user=root image -- bash</code> (user not found), also tried to run <code>su -</code> in the image (authentication failure), with no success. The base image used for building the app is java:8.</p>

<p>These are my docker settings in build.sbt:</p>

<pre><code>.settings(
    Seq(
      dockerBaseImage := "java:8",
      publishArtifact := false,
      dockerExposedPorts ++= Seq(8088), 
      packageName in Docker := "api-endpoint"
    ))
</code></pre>

arunasm
<p><code>--user=root</code> in <code>kubectl</code> is for authenticating on your kube-apiserver and not forcing the container to execute a command as a user in the container.</p>

<p>If you are running docker on your nodes and want to force escalate to <code>root</code> you can ssh to the node where your container is running and then run:</p>

<pre><code>$ docker exec -it --user=root &lt;container-id&gt; bash
# or
$ docker exec -it -u root &lt;container-id&gt; bash
</code></pre>

<p>You can find out the node where your pod/container is running by using:</p>

<pre><code>$ kubectl describe pod &lt;pod-id&gt;
</code></pre>
