Docker: user change in terminal prompt
<p>I was just looking at the <a href="https://www.linode.com/docs/applications/containers/how-to-install-docker-and-deploy-a-lamp-stack" rel="nofollow">Docker linode/lamp container documentation</a>, and encountered the following warning:</p>

<p><code>sudo docker run -p 80:80 -t -i linode/lamp /bin/bash</code> <strong><em>Caution: This command also changes the terminal prompt to the root user within the new container.</em></strong></p>

<p>Assuming I have the following Dockerfile</p>

<pre><code>FROM alpine:3.3

RUN apk --update add \
      build-base python-dev \
      ca-certificates python &amp;&amp;\
    adduser -D -u 1001 not_root

USER not_root

CMD ["/bin/sh"]
</code></pre>

<p>When I run some python code in this container (loaded from a volume and executed via <code>docker run</code>), it gets executed as the <em>not_root</em> user.</p>

<p>But when I then later do a <code>docker exec -it -u root that_container /bin/sh</code> in order to manually install a package, lets say for testing purposes, does the running container started with <code>docker start</code> or <code>docker run</code> still run as <em>not_root</em>? Or will that <code>docker exec</code> have changed the active user?</p>