title: How do I write to a volume container as non-root in docker?
body: <p>How do I mount a volume writable by a non-root container user? I am ok with either the volume being owned by the non-root user or permissions being set to 777.</p>
  
  <p>Dockerfile:</p>
  
  <pre><code>FROM alpine
  RUN adduser -D myuser
  USER myuser
  </code></pre>
  
  <p>Build image:</p>
  
  <pre><code>docker build -t example .
  </code></pre>
  
  <p>Run image, see /app unwritable by user</p>
  
  <pre><code>% docker run -i -t -v myapp:/app example /bin/sh
  / $ whoami
  myuser
  / $ ls -lha / | grep app
  drwxr-xr-x    2 root     root        4.0K Nov 12 21:01 app
  / $ 
  </code></pre>
  
  <p>We can see app is globally readable but only writable by root.</p>