title: Build with docker and --privileged
body: <p>I'm using <a href="https://aws.amazon.com/blogs/ai/build-a-voice-kit-with-amazon-lex-and-a-raspberry-pi/" rel="noreferrer">this guide</a> to Build a Voice Kit with Amazon Lex and a Raspberry Pi, but I need to use Docker. 
  The problem is that the script that the guide curls and runs requires access to /dev/tty. I can grant access to /dev/tty when <em>running</em> docker containers, but I don't know how to do that when building containers. </p>
  
  <p>My Dockerfile looks like this:</p>
  
  <pre><code>FROM resin/rpi-raspbian
  
  WORKDIR /app
  
  ADD . /app
  
  #The script requires these
  RUN apt-get update
  RUN apt-get install iputils-ping
  
  #The script has to be run with sudo priviliges but not as root
  USER root
  ADD /sudoers.txt /etc/sudoers
  RUN chmod 440 /etc/sudoers
  
  
  RUN useradd -ms /bin/bash lex
  RUN echo 'lex:test' | chpasswd
  
  RUN curl https://get.pimoroni.com/phatdac | bash 
  
  USER lex
  
  EXPOSE 80
  
  #Comment the last RUN command and uncomment this
  #CMD curl https://get.pimoroni.com/phatdac | bash 
  </code></pre>
  
  <p>And when I try to build the container with</p>
  
  <pre><code>docker build -t raspi1 .
  </code></pre>
  
  <p>it crashes on the script, because it can't access /dev/tty.</p>
  
  <p>When running a container, I can use this script to grant access to /dev/tty and /dev/snd</p>
  
  <pre><code>#!/bin/sh
  
   docker run -ti --rm \
       -v /dev/snd:/dev/snd \
        --privileged \
       raspi7 
  </code></pre>
  
  <p>and then try to use the script on the startup with CMD in the Dockerfile. But if I do that, then I need to use the script every time when running and I also need to do RUN on other stuff after the script has finished which would be nice to have on the Dockerfile when building.</p>
  
  <p>TLDR;
  How to grant privileges to /dev/tty and /dev/snd when building a docker image?</p>